简体   繁体   English

从我的应用程序拍摄的照片,保存在正确的文件夹中,但在图库中看不到

[英]Photo taken from my app, saved in the right folder but can't see in the gallery

My photo is saved when i take it but i can't see it in the gallery! 拍摄时我的照片已保存,但在图库中看不到! I see it with a file manager in the right folder but not in the gallery. 我在正确的文件夹中看到了文件管理器,但在图库中却没有看到它。

Intent intent = new Intent();
           // Picture from camera
           intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);

           Date date = new Date();
           DateFormat df = new SimpleDateFormat("-mm-ss");

           String newPicFile = "Photo"+ df.format(date) + ".jpg";
           String outPath = Environment.getExternalStorageDirectory() + "/DCIM/" + newPicFile;
           File outFile = new File(outPath);

           mCameraFileName = outFile.toString();
           Uri outuri = Uri.fromFile(outFile);
           intent.putExtra(MediaStore.EXTRA_OUTPUT, outuri);


           startActivityForResult(intent, CAPTURE_IMAGE );

I tried everything but nothing works fine! 我尝试了一切,但没有任何效果!

Check that the gallery is refreshed; 检查图库是否已刷新; it doesn't refresh often. 它不经常刷新。 You can call a request to refresh using something like this: 您可以使用以下方法调用刷新请求:

((BaseAdapter) yourGalleryView.getAdapter()).notifyDataSetChanged() [[BaseAdapter)yourGalleryView.getAdapter())。notifyDataSetChanged()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将图库照片复制到我的应用程序的文件夹中 - Copy the gallery photo into my app's folder 如何在Android应用程序的图库中显示保存的照片 - How to show saved photo in gallery in Android app Java android从图库中为文件夹选择照片 - Java android pick a photo from gallery for a folder 无法使用 CameraX 将在应用程序内拍摄的图像保存到图库,因为“不允许操作” - Can't save image taken inside app to gallery using CameraX because "Operation not permitted" 无法在circleimageview中设置从Firebase当前用户拍摄的照片Uri? - can't set photo Uri which is taken from firebase current user in circleimageview.? 如何创建从数据库拍摄并保存文件夹的图片的路径? - how to create a path to a picture taken from a database and saved a folder? 退出应用程序会导致从图库拍摄的图像到 go - Exiting App causes the image taken from gallery to go 如果用户在注册时未从图库中选择任何照片,该如何提醒用户? - How can I alert the user if he doesn't pick any photo from gallery while registering? 为什么我在avd应用程序菜单中看不到我的应用程序? - Why can't I see my app in the avd app menu? 无法通过Android应用在Facebook中共享照片 - Can't share a photo in Facebook from Android app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM