如何使应用程序显示在从菜单中选择图像

How to make app show in pick image from menu

我有点卡在这里,我创建了一个图库应用程序,但由于某些原因,我不知道如何让它被系统识别为图库应用程序,以便我可以从其他应用程序中选择图像例如 Whatsapp,我看到菜单上出现了除我之外的其他第 3 方。

将此添加到您的清单中

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

然后在 activity 打开时处理意图并从 EXTRAS 获取图像的 URI。