Android Refresh System Album
Recently in the project, found to save the photos to the mobile phone designated path, some phones open the System album actually do not see, such as Samsung S3, Xiaomi 2, Sony Lt26i and HTC and other parts of the model! But ZTE N881f, Meizu 3 and other viewing system albums can be normal check to see the latest saved photos! The reason may be that some of the models of the album is not automatically refreshed every time it! Now the solution is the following code:
// scan saved photo files, refresh albums New = uri.fromfile (new File (ImagePath)); Intent.setdata (Uri); Context.sendbroadcast (intent) ;
In the code to scan a file through Intent.action_media_scanner_scan_file, the purpose of refreshing the album,ImagePath refers to the path to save the photo,
such as "/storage/emulated/0/dcim/photos/abc123.jpg", so save the album will be automatically refreshed!
Android Refresh System Album