Question

I am showing all available videos in a gridView on which are in SDCard by using following code.

String[] proj= {MediaStore.Video.Media._ID,MediaStore.Video.Media.DATA,MediaStore.Video.Media.DISPLAY_NAME,
                MediaStore.Video.Media.SIZE };
        videocursor = getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, proj, null, null, null);

It is working fine... But if i made any changes to videos (i.e rename, delete) above code is not working. It is showing old content only, means not refreshing. How can i solve this problem

Was it helpful?

Solution

what should do is the following :

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

right after your code .

provides a way for applications to pass a newly created or downloaded media file to the media scanner service.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top