Issue in Picking image From gallery
I am using following code to pick image from gallery
public void takePhotoFromLibrary() {
_isFromLogin = false;
try {
// Launch picker to choose photo for selected contact
Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
intent.setType("image/*")开发者_开发百科;
// intent.putExtra("crop", "true");
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 200);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG
.toString());
intent.putExtra("noFaceDetection", false);
startActivityForResult(intent, PHOTO_PICKED);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
I am using Lg optimus p350 for testing. In this case when i select an image picked by camera onActivityForResult is not getting called. Can anyone please help me with this?
It may be help you..
http://android-er.blogspot.com/2011/02/select-image-using-android-build-in.html
How to pick an image from gallery (SD Card) for my app?
If you use this intent instead to launch the pick image activity:
Intent i = new Intent(Intent.ACTION_PICK, Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, PICK_IMAGE_REQUEST_CODE);
Then you will get a callback to:
@Override
protected void onActivityResult(int requestCode, int resultCode, final Intent intent) { }
when the user has selected an image.
精彩评论