Hey all,

I am saving an image taken by the camera to a unique folder on the
sdcard.  The image saves fine, but I cannot view it in the Gallery.  I
can see it in the file system, but I cannot view the image in the
Gallery app until I reboot the phone or mount the sdcard, and then
umount.


Here's the code:


     public static void saveImageToCard (Bitmap bm, String title,
String description, Context context) {

            //replace and append the title with the correct extension
            title = title.replace(" ", "_") + ".jpg";

            File Directory = new File(Environment.getExternalStorageDirectory
() + "/myFolder");
                File file = new File(Directory.getAbsoluteFile() + "/" + title);

                if (!Directory.exists()) {
                        Directory.mkdirs();
                }

                try {
                        FileOutputStream fos = new FileOutputStream(file);
                        bm.compress(Bitmap.CompressFormat.JPEG, 100, fos);
                        fos.close();
                } catch (IOException e) {
                        e.printStackTrace();
                }

        }



As I said, the file is saved fine, I can see it in the FS, and I can
view it after the card has been umounted/mounted or rebooted.   Is it
an issue that I'm not correctly closing the file??  I don't think
that's it, but I'm not sure why I can't view the image.  I believe I
tried saving the file using getContentResolver().insert() and didn't
have this issue, but I want to save the images to a specific folder
that I create.


Any ideas?


Thanks in advance,

Mike






-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to