-1

I am working on Galaxy Nexus(Android 4.0.3). I refer this to link https://developer.android.com/training/camera/photobasics.html to save captured image to store directly into gallery but it is storing image to Misc files. Please tell me what i have to do to store it in gallery.

Thanks in advance.

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123
Madhur Rampal
  • 541
  • 3
  • 9
  • 21
  • 1
    I have to give you a down vote because the answer to this question was so easy to find with Google. – Torben Apr 25 '12 at 11:15

2 Answers2

2

Yes Gallery is not Storage It show media that stored in different locations But to save it in Gallery and it is Specially For HIgh resolution more memory consume Images Use MediaStore Now as u Know Just capture image get its path (use intent) and just Following Code To save any Image to gallery

public static Uri addImageToGallery(Context context, String filepath,String title,String ) {    
    ContentValues values = new ContentValues();
    values.put(Media.TITLE, title);
    values.put(Media.DESCRIPTION, description); 
    values.put(Images.Media.DATE_TAKEN, System.currentTimeMillis());
    values.put(Images.Media.MIME_TYPE, "image/jpeg");
    values.put(MediaStore.MediaColumns.DATA, filepath);

    return context.getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
}
Jayman Jani
  • 1,251
  • 10
  • 15
1

Gallery is not an image storage. It is an app that displays images stored in different locations on the device.

Check this out:

android how to save captured image into phones gallery

Community
  • 1
  • 1
Torben
  • 3,805
  • 26
  • 31
  • But my phone does'nt have sdcard how can i save my captured image? – Madhur Rampal Apr 25 '12 at 11:15
  • And how to know know path of current image according to link what you have sent. – Madhur Rampal Apr 25 '12 at 11:18
  • Read the chapter titled "Saving the Photo" from the link that you provided in your question. – Torben Apr 25 '12 at 11:24
  • Ok, it is saving in gallery directly when i tap on captuted image it is giving an error "Unfortunatly gallery has atopped working". I pass file path and name what has been described in above link. What i have to do to fix it. – Madhur Rampal Apr 25 '12 at 11:49