Can anyone help? I just need a simple example on how to save image while being able to specify the file name.
Cheers, Ren On Sat, Mar 28, 2009 at 9:59 PM, Ren <[email protected]> wrote: > I tried > values.put(MediaStore.Images.ImageColumns.TITLE, "newpic.jpg"); > values.put(MediaStore.Images.ImageColumns.MIME_TYPE, "image/jpeg"); > > It didn't work. > > > On Fri, Mar 27, 2009 at 6:46 PM, for android <[email protected]> wrote: > >> >> did u try TITLE >> On 3/27/09, [email protected] <[email protected]> wrote: >> > >> > Can any one help on this? >> > >> > On Mar 26, 6:20 pm, Ren <[email protected]> wrote: >> >> 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 >> > > >> > >> >> >> >> > > > -- > Kind Regards, > Ren > -- 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 -~----------~----~----~----~------~----~------~--~---

