I am using the following code to crop images from camera and gallery :
private void doCrop() {
final ArrayList cropOptions = new ArrayL
Hi Can u Try this,
@Override
public void onActivityResult(final int requestCode, int resultCode,
Intent data) {
try {
switch (requestCode) {
case GALLERY_PIC_REQUEST:
if (resultCode == RESULT_OK) {
try {
picUri = data.getData();
System.out.println("Image Path::> "+picUri.getPath());
performCrop();
} catch (Exception e) {
ShowDialog_Ok("Error", "Couldn't load photo");
}
}
break;
case CAMERA_PIC_REQUEST:
if (resultCode == RESULT_OK) {
try {
picUri = data.getData();
System.out.println("Image Path::> "+picUri.getPath());
performCrop();
} catch (Exception e) {
ShowDialog_Ok("Error", "Couldn't load photo");
}
}
break;
case CROP_PIC_REQUEST:
Bitmap bitmap;
String path = "";
if (resultCode == RESULT_OK) {
String oldPath = fashionlyPreferences.getImagePath();
try {
picUri = data.getData();
path = Helper.GetPathFromURI(context, picUri);
bitmap = BitmapFactory.decodeFile(path);
Img_View.setImageBitmap(bitmap);
} catch (Exception e) {
ShowDialog_Ok("Error", "Couldn't load photo");
}
}
break;
}
} catch (Exception e) {
}
}
//Function for Crop
private void performCrop() {
// take care of exceptions
try {
if (picUri!=null) {
Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.setDataAndType(picUri, "image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("scale", true);
cropIntent.putExtra("aspectX", 0);
cropIntent.putExtra("aspectY", 0);
//cropIntent.putExtra("outputX", 400);
// cropIntent.putExtra("outputY", 400);
cropIntent.putExtra("return-data", false);
startActivityForResult(cropIntent, CROP_PIC_REQUEST);
}
}
// respond to users whose devices do not support the crop action
catch (ActivityNotFoundException anfe) {
Toast.makeText(this, "This device doesn't support the crop action!", Toast.LENGTH_SHORT).show();
}
}