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