开发者

Add my program to "Complete action using..." list, when clicking a file in filebrowser

When clicking a file in any filebrowser the user usually gets to choose from a list of which app to open it with.

How can I add my program to this "Complete action using..." list, so that the file can be opened in my app?

I know this has to be added to the manifest somehow, but I can't find what to add.

RESULT:

I followed the answers I got here and made it work with this code:

<intent-filter android:label="MyApp">
<action android:name="android.intent.action.VIEW" />
<action android:name="com.MyApp.action.EDIT_NOTE" />开发者_开发知识库
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
<data android:pathPattern=".*txt" />


An example of how to link to doc, xls or pdf file extensions:

<activity android:name="ActivityTest" android:label="@string/app_name">
        <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:scheme="http" />
            <data android:pathPattern=".*doc" />
            <data android:pathPattern=".*xls" />
            <data android:pathPattern=".*pdf" />
        </intent-filter>
        </activity>

You can also create the filter for specific Mime types. More info: http://d.android.com/guide/topics/intents/intents-filters.html


Create an Intent filter to handle the MIME type of that file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜