1

from this question I understand that if I want to remove a reference for a (video) file from the media library, I can do this:

Uri videoUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
Uri itemUri = ContentUris.withAppendedId(videoUri, mediaId);
getContentResolver().delete(itemUri, null, null);

what I miss is how to retrieve the mediaId.

For this file I have its path, filename, size, etc.

Any idea?

Community
  • 1
  • 1
dentex
  • 3,223
  • 4
  • 28
  • 47
  • As a workaround, I found that I already had the id, because I always manually add the file that eventually I want to delete, in my app. So I store the id into a shared preference. But this is not the answer. – dentex Jul 04 '13 at 09:42

1 Answers1

0

here the answer, look at the method getVideoIdFromFilePath:

https://stackoverflow.com/a/11603899/1865860

Community
  • 1
  • 1
dentex
  • 3,223
  • 4
  • 28
  • 47