简体   繁体   中英

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM