开发者

How to update Media store after file is added or deleted from a directory

开发者 https://www.devze.com 2023-03-07 21:34 出处:网络
I have an interface to record and play the videos. After recording a new video it is not updated tomedia store. The same problem I am facing while deleting a recorded file.

I have an interface to record and play the videos. After recording a new video it is not updated to media store. The same problem I am facing while deleting a recorded file.

My question is:

How I can update the media store after adding or deleting a video file in a specific d开发者_运维技巧irectory.

Thanks, Dipesh


Add this line after save or delete function

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


See the MediaScannerConnection's scanFile method: http://developer.android.com/reference/android/media/MediaScannerConnection.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号