android how to open external file with my application

China☆狼群 提交于 2019-12-01 14:18:39

If you want want your app to recognize specific files, you need to use intent filter inside one of your activity tags in manifest. For example, to open pdf file with your app you need to use:

<activity android:name=".ActivityThatKnowsHowToHandlePDFFiles">

        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="file" />
        <data android:mimeType="*/*" />
        <data android:pathPattern=".*\\.pdf" />

</activity>

In your case with sqlite database file it can be .sqlite, .db - it depends on how did you name it.

More details on data intent filter: http://developer.android.com/guide/topics/manifest/data-element.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!