安卓:添加一个应用程序到"设置图片为"名单应用程序、名单、图片、QUOT

2023-09-06 03:34:50 作者:杳无期

我想加入我的应用程序设置列表中,在画廊中所示,当我选择图像。如果用户在画廊中打开图像,有一个按钮设置为。当用户点击它,他将得到一个列表。换句话说,如果他希望使用图像中的我的应用程序。 我曾尝试:

I'm trying to add my app to "set as" list, that shown in gallery when I choose an image. If the user open an image in the gallery, there is a button for set as. when the user tap it, he will get a list. In other words, if he want to use that image in my app. I have tried :

<intent-filter>
            <action android:name="android.intent.action.SET_WALLPAPER" />

            <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

但我什么也没得到。

but i got nothing.

推荐答案

现在我已经明白了: 你必须注册你的活动,以处理来自其他应用的图像输入。 插入这在你的清单:

Now i've understand: You have to register your Activity to handle Images input from other apps. Insert this in your Manifest:

<activity android:name=".YourActivity" >
<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.SEND_MULTIPLE" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />
</intent-filter>
</activity>

更多的相关信息在发展>培训>接收从其他应用程序简单的数据