Mike Murphy:

Thanks for the reply, writing my own *second* activity is the path I
will go down if I can't get this to work.

I don't think that this is good general practice if the intent filter
API is working as documented.  It pollutes the android device with
needless activities that work like file browser but are hardcoded.
This breaks the abstraction that intents were meant to provide and
obviously doesn't allow users to specify a different activity to
handle said file format.

I guess I am looking for acknowledgement that this doesn't work as is
documented *or* that I am doing it incorrectly.  Multiple people have
gone down this path and there are several threads on this group that
makes it seem like it works in some places and doesn't work in other
places.  One other thing I didn't mention is that I am using a version
of Gingerbread that NVIDIA is using.  So this bug may be fixed a while
back and I could just be out of luck until ICS is running on my
hardware.

Specifically, I would state this problem a little stronger than I have
so far.

Write a simple activity, perhaps all it does is log which file it is
started with.  Add a intent filter that tries to map this activity
view to a file with a given extension *but doesn't map this activity
in any other way*.  This file format needs to be completely
unregistered in the system any other way, webkit or otherwise so pdf
isn't an option.  Attempt to launch the activity with am just
specifying the category and the file.  It will not work and it should,
given the documentation around intents and intent filters.

Then pick up one of the may file browsers attempt to double click on
the file.  This also will not work; and this failure in the public
android API is leading to app pollution because people are just
working around the problem by writing half-done versions of file
browsers hard-coded to their desired activity.

Chris

On Nov 5, 6:26 am, Zsolt Vasvari <[email protected]> wrote:
> IIRC, I tried doing this unsuccessfully with OFX files.  I don't
> remember the details, but, if my recollection is right, unless the
> file extension is defined in android.webkit.MimeTypeMap, it won't
> work.
>
> On Nov 5, 9:18 am, chrisn <[email protected]> wrote:
>
>
>
>
>
>
>
> > This is *incredibly frustrating.  I have changed my intent-filter to
> > look like:
>
> > <intent-filter>
> >         <action android:name="android.intent.action.VIEW" />
> >         <category android:name="android.intent.category.DEFAULT" />
> >         <data android:mimeType="*/*"/>
> >         <data android:scheme="file" android:host="*"
> > android:pathPattern=".*\\.bif"/>
> >       </intent-filter>
>
> > $ adb shell am start -a android.intent.action.VIEW -d
> > file:///mnt/sdcard/UIComposer/basicredcube.bif-n
> > com.nvidia.devtech.UICViewer/.UICViewer
> > Starting: Intent { act=android.intent.action.VIEW
> > cat=[com.nvidia.devtech.UICViewer/.UICViewer] dat=file:///mnt/sdcard/
> > UIComposer/basicredcube.bif}
>
> > This works fine.
>
> > Dropping the -n {explicity component} from the equation fails.
>
> > What is going on?
>
> > Chris
>
> > On Nov 4, 5:26 pm, chrisn <[email protected]> wrote:
>
> > > I am having trouble getting my android system to launch my activity
> > > for all files with a given extension.
>
> > > I am using OI File Manager, and trying to get my activity launched for
> > > all files with a given suffix (bif).
>
> > > Here is the relevant section of my manifest:
>
> > > <application
> > >                         android:icon="@drawable/icon"
> > >                         android:label="@string/app_name" >
> > >                 <!--We derive from native activity so we can access 
> > > information
> > >                 about the intent the activity was launched with -->
> > >                 <activity android:name="com.nvidia.devtech.UICViewer"
> > >                                 android:label="@string/app_name"
> > >                                 android:screenOrientation="landscape">
> > >                         <!-- Tell NativeActivity the name of or .so -->
> > >                         <meta-data android:name="android.app.lib_name"
> > >                                         android:value="UICViewer" />
> > >                         <intent-filter>
> > >                                 <action 
> > > android:name="android.intent.action.VIEW" />
> > >                                 <category 
> > > android:name="android.intent.category.DEFAULT" />
> > >                                 <category 
> > > android:name="android.intent.category.BROWSABLE" />
> > >                                 <data android:mimeType="*/*" />
> > >                                 <data android:scheme="file"/>
> > >                                 <data android:host="*" />
> > >                                 <data android:pathPattern=".*\\.bif" />
> > >                         </intent-filter>
> > >                 </activity>
> > >     </application>
>
> > > And here is the output of adb logcat when I 'click' on the file:
>
> > > I/ActivityManager(  145): Starting: Intent
> > > { act=android.intent.action.VIEW dat=file:///mnt/sdcard/UIComposer/
> > > basicredcube.biftyp=*/* cmp=android/
> > > com.android.internal.app.ResolverActivity } from pid 566
> > > I/ActivityManager(  145): Displayed android/
> > > com.android.internal.app.ResolverActivity: +370ms
>
> > > All that happens is that the screen goes slightly darker than it was
> > > and my app doesn't appear.
>
> > > Any thoughts as to why this may be?  Or more thorough ways to debug
> > > this?
>
> > > Chris- Hide quoted text -
>
> > - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to