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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en