imagen del teléfono en EditText

I am trying to write an app allows user to read a note with picture in it. Right now I have a problem about how to import an image file from the phone and add it in the edit window(EditText). The number of the images is not fixed. Is there someone who can help me? Thanks!

preguntado el 10 de marzo de 12 a las 16:03

1 Respuestas

First, you cannot display an image into EditText. You need to use ImageView for it. You can read image file and convert it into bitmap and give bitmap object as source of imageview. You can find out more for ImageView


Give some more explanation what exactly you want to do, so i can help you better. However this can be helpful to you.

String imageFilePath;
ImageView clicked_pic;

imageFilePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/gps_123.png"; // path to an image which is stored in the sd-card.

 Bitmap imgg = BitmapFactory.decodeFile(imageFilePath);
 clicked_pic.setImageBitmap(imgg); // set image to imageview.


respondido 19 mar '12, 12:03

Hi,thank you for your reply. What I am trying to do now is use Uri getPath() to retrieve the path, however, the returned string is not exact path like /SDCARD/...., instead, it start with /external , I need to use this string to show the image, which method can I use? Thank you! - Rico

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.