And fwiw, Android basically knows nothing about extensions.  Everything at
this point is identified through MIME types.  There are some hacks you can
do with intent filters to kind-of do matching against file extensions, but I
wouldn't recommend it.

On Sun, Sep 19, 2010 at 7:25 AM, Mark Murphy <[email protected]>wrote:

> On Sun, Sep 19, 2010 at 10:08 AM, ls02 <[email protected]> wrote:
> > My app has two private file formats with distinctive extensions. How
> > to I register their MIME types and associate them with file
> > extensions? My understanding that then my app can be launched to
> > handle a file. How is this done and how to extract the file path my
> > app is launched to handle?
>
> Use the <data> element in your manifest and the android:mimeType attribute:
>
> <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="application/pdf" />
> </intent-filter>
>
> The BROWSABLE allows you to be launched by clicks in the browser. The
> Uri to the file is in getIntent().getData() in your activity.
>
>
> http://github.com/commonsguy/cw-advandroid/tree/master/Introspection/URLHandler/
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Training in London: http://skillsmatter.com/go/os-mobile-server
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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