Android implements saving pictures locally and displaying them in albums
Taking photos and saving pictures locally is a common requirement in Android. I encountered a problem before, that is, in 4.4, an anr will appear when refreshing the album. After a while, baidu solved this problem.
The first is to save the picture locally
The above is the method to save pictures. After saving, you should notify the album to refresh. In 4.4:
In 4.4, the above is realized by sending broadcast:
The above two methods are different. The path of refreshing the URI of the SD card is different from that of refreshing the URI of a single file. The path of refreshing the SD card is the root directory of external storage, and the path of refreshing a single file is the specific path where you save the picture. This is the pit I encountered temporarily. It has not been tested in 4.4. If there are problems in the test, please comment.
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.