Android相机意图未保存在图库中 [英] Android camera Intent not saving in gallery
问题描述
我正在创建一个简单的应用程序,该应用程序使用相机意图进行拍照.它可以工作并且图片被保存在:storage/emulated/sd/pictures/my_folder. 问题是我无法从Android Gallery应用程序中看到这些图片.
I am creating a simple application which takes pictures using the camera intent. It works and the pictures are being saved in : storage/emulated/sd/pictures/my_folder . The problem is that I can't see those pictures from the Android Gallery app.
我看到了不同的帖子,但是找不到答案. 如何观看图片?
I saw different posts about but I couldn't find an answer. How can I watch the pictures?
谢谢
推荐答案
您只需要发送广播"ACTION_MEDIA_SCANNER_SCAN_FILE",以便mediascanner可以扫描您保存的图像.
You just need to send an broadcast "ACTION_MEDIA_SCANNER_SCAN_FILE" so that the mediascanner can scan for the image you saved.
Intent mediaScanIntent = new Intent( Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
mediaScanIntent.setData(uri);
sendBroadcast(mediaScanIntent);
只需设置新创建图像的uri. :)
just set the uri of the the newly created image. :)
这篇关于Android相机意图未保存在图库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!