sivanesan1 sivanesan1 - 6 months ago 14
Android Question

how to browse image in sd card using android

I have some images in my emulator sdcard and i want to select a particular image on it. refer my code below,

int RESULT_LOAD_IMAGE = 1;
Intent i = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(i, RESULT_LOAD_IMAGE);


Actually push a png image in my emulator sd card , but use the above code my emulator shows no media found. guide me,

Answer

Pick image using external app help(like gallery)?

public void pick(View V) {
    Intent it = new Intent();
    it.setType("image/*");
    it.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(it, 101);
}

I used onActivityResult here to output it on imageView later And you can convert it to URI, Bitmap or whatever you need

Comments