0

I want to delete an image from the gallery and for some important reasons i added my delete activity in the share button of the gallery with the following intent filter

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

and in my activity i use codes to delete the selected image if some condition is met, then i used the following code to refresh the gallery.

    sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));

everything works perfect but after deleting,the image is still shown when pressing the back button. the gallery is refreshing only if i quit the currently opened gallery and reopen it please help, and sorry for the bad english

4

1 回答 1

1

我知道使用

    sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));

是资源密集型的,因为它安装和卸载 SD 卡,会导致其他正在使用它的应用程序出现问题。您可能应该首先找到一个更好的实现来刷新画廊,然后看看您是否可以解决后退按钮问题(可能需要向您覆盖的 onStart() 方法添加一些内容。)

于 2013-08-03T04:44:26.547 回答