I have the following code to save a bitmap to a jpg file. It works except I
couldn't specify the file name.

The image file is save in /sdcard/dcim/Camera. How do I specify a file name,
or even the saved path?

Cheers

ContentValues values = new ContentValues();
values.put(MediaStore.Images.ImageColumns.DISPLAY_ NAME, "newpic");
values.put(MediaStore.Images.ImageColumns.MIME_TYP E, "image/jpeg");
Uri uri = getContentResolver().insert(MediaStore.Images.Medi
a.EXTERNAL_CONTENT_URI, values);


try{
OutputStream out = getContentResolver().openOutputStream(uri);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
}catch(IOException e){
Log.e("save image", "failed to save image", e);
}

-- 
Kind Regards,
Ren

--~--~---------~--~----~------------~-------~--~----~
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