示例:当您单击按钮上传图片时,您会看到选择文件的对话框。然后你可以选择一个你想选择的应用程序。如何让我的应用出现在该对话框中?
最佳答案
您需要在要处理上传的 Activity 中的 list 文件中添加 Intent 过滤器。例如: 我有一个处理图像导入的 Activity,这是我写的。
activity android:name="com.ImportTheme">
<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:host="*" android:scheme="file" android:mimeType="image/*" />
</intent-filter>
</activity>
如您所见,您需要添加适合您查找内容的 mime 类型,在我的示例中,我只需要图片 - png、jpg 等。
检查下link ,您有一个 MIME 类型列表。
关于android - 如何使 Activity 出现在 "Choose file"对话框中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14946734/