I think you might want something like this:

// start the image picker activity - the 999 is just a unique request
code
startActivityForResult( new Intent(Intent.ACTION_PICK,
  android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI),
999);

at this point, the Gallery app will start and your app will pause

To get the results (the selected image):

// meanwhile, back in your activity...
protected final void onActivityResult(final int requestCode, final int
resultCode, final Intent i) {
        super.onActivityResult(requestCode, resultCode, i);

  // this matches the request code in the above call
  if (requestCode == 999) {
    Uri _uri = i.getData();

    // this will be null if no image was selected...
    if (_uri != null) {
      // now we get the path to the image file
      cursor = getContentResolver().query(_uri, new String[]
{ android.provider.MediaStore.Images.ImageColumns.DATA },
                                          null, null, null);
      cursor.moveToFirst();
      String imageFilePath = cursor.getString(0);
      cursor.close();
    }
  }


this will give you the absolute path to the selected image file.

On Jun 13, 12:26 am, Meryl Silverburgh <[email protected]>
wrote:
> Hi,
>
> Can you please tell me how can i launch the intent to pick image from SD card?
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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