I have to use two different intents, one to select an image and the other to crop the image.
Is there any way out to use a single Intent to select and crop the Image.
The below code only selects the image but does not crop it -
Uri outuri = Uri.fromFile(createFile(path));
//GalIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
//GalIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
GalIntent = new Intent("com.android.camera.action.CROP");
GalIntent.setType("image/*");
GalIntent.putExtra("crop", "true");
GalIntent.putExtra("outputX", 1000);
GalIntent.putExtra("outputY", 1000);
GalIntent.putExtra("aspectX", 10);
GalIntent.putExtra("aspectY", 10);
GalIntent.putExtra(MediaStore.EXTRA_OUTPUT, outuri);
GalIntent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
GalIntent.putExtra("return-data", false);
startActivityForResult(GalIntent, 1);
I have to get the intent data onActivityResult and start another intent to crop the data -
CropIntent = new Intent("com.android.camera.action.CROP");
CropIntent.setDataAndType(imageUri, "image/*");
CropIntent.putExtra("crop", "true");
CropIntent.putExtra("outputX", 1000);
CropIntent.putExtra("outputY", 1000);
CropIntent.putExtra("aspectX", 10);
CropIntent.putExtra("aspectY", 10);
//CropIntent.putExtra("scaleUpIfNeeded", true);
CropIntent.putExtra(MediaStore.EXTRA_OUTPUT, outuri);
CropIntent.putExtra("return-data", false);
//CropIntent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
startActivityForResult(CropIntent, 1);