문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top