How to resize a photo in android? - android

I'm actually new in android but I managed to take a picture with my app and this is how I take a picture and save it... The problem is that I need to resize it before saving it on the phone... But I can't figure out how to to that.. I've googled my problem but the only thing I found was with bitmap pictures and that's not my case I guess..
Here is the code I'm using to take the picture:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM),"GUASTO" + System.currentTimeMillis() + ".jpg"); /
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoPath);
startActivityForResult(intent, SCATTA_FOTO);
Thank you!!

public static int PIC_CROP=81;
Intent cropIntent = new Intent("com.android.camera.action.CROP");
//indicate image type and Uri
cropIntent.setDataAndType(ImageUri, "image/*");
//set crop properties
//indicate aspect of desired crop
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
//indicate output X and Y
cropIntent.putExtra("outputX", 640);
cropIntent.putExtra("outputY", 640);
//retrieve data on return
cropIntent.putExtra("return-data", true);
//start the activity - we handle returning in onActivityResult
startActivityForResult(cropIntent, PIC_CROP);
and in onActivityResult()
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
if(requestCode==PIC_CROP)
{
if(resultCode==RESULT_OK)
{
Bundle extras = data.getExtras();
if (extras != null) {
Bitmap bmp = extras.getParcelable("data");
saveCropPhoto(bmp);
}
Toast.makeText(getApplicationContext(), "picture cropped",Toast.LENGTH_SHORT).show();
}
}
}
saveCropPhoto() method
public void saveCropPhoto(Bitmap bmp)
{
Toast.makeText(getApplicationContext(), "in save",Toast.LENGTH_SHORT).show();
String dir = Environment.getExternalStorageDirectory().toString() + "/folderName/";
File newdir = new File(dir);
newdir.mkdirs();
FileOutputStream out = null;
Calendar c = Calendar.getInstance();
String date = fromInt(c.get(Calendar.MONTH))
+ fromInt(c.get(Calendar.DAY_OF_MONTH))
+ fromInt(c.get(Calendar.YEAR))
+ fromInt(c.get(Calendar.HOUR_OF_DAY))
+ fromInt(c.get(Calendar.MINUTE))
+ fromInt(c.get(Calendar.SECOND));
File imageFileName = new File(newdir, "crop_"+date.toString() + ".jpg");
try
{
out = new FileOutputStream(imageFileName);
bmp.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
out = null;
if(tempFile.exists())
tempFile.delete();
} catch (Exception e)
{
e.printStackTrace();
}
}

Related

Get Output Cropped Image URI

I have implemented image cropping in my app using android intent like below:
CropIntent = new Intent("com.android.camera.action.CROP");
I have received the cropped image and displayed on my UI but I want to perform further use cases like upload the cropped image uri. The problem is that no uri is returned in activity.
Here's my crop image intent snippet:
galleryFAB.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Log.d(TAG, "Gallery Btn Clicked");
selectFromGallery();
}
});
private void selectFromGallery() {
galleryIntent = new Intent(Intent.ACTION_GET_CONTENT);
galleryIntent.setType("image/*");
startActivityForResult(Intent.createChooser(galleryIntent, "Choose From"), 2);
}
my code in activity result method:
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
InputStream inputStream;
if (requestCode == 2 && resultCode == RESULT_OK){
if (data != null){
cropImageUri = data.getData();
userImage.setImageURI(cropImageUri);
try {
originalBitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), cropImageUri);
inputStream = getContentResolver().openInputStream(data.getData());
originalBitmap = BitmapFactory.decodeStream(inputStream);
Log.d(TAG, "Original bitmap byte count is:\t" + originalBitmap.getByteCount());
resizedBitmap = getResizedBitmap(originalBitmap, 200);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
resizedBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
Log.d(TAG, "Resized bitmap byte count is:\t" + resizedBitmap.getByteCount());
try {
File file = saveBitmap("avatar_image");
upLoadFile(file);
} catch (IOException ex) {
ex.printStackTrace();
}
byte[] bytes = stream.toByteArray();
/**
* For Shared Preferences
* **/
encodedImage = Base64.encodeToString(bytes, Base64.DEFAULT);
imagePrefs = getSharedPreferences("ImagePrefs", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = imagePrefs.edit();
editor.putString("image_user", encodedImage).commit();
upLoadBytes(bytes);
} catch (IOException e) {
e.printStackTrace();
}
cropImage();
}
} else if (requestCode == PERM_CODE){
if (data != null){
//I want to get the cropped image uri here but unable to. Have tried converting the bitmap rcvd here to uri but in activity, ntn is returned. kindly guide me
Bundle bundle = data.getExtras();
originalBitmap = bundle.getParcelable("data");
userImage.setImageBitmap(resizedBitmap);
}
}
}
my crop image function:
private void cropImage() {
try {
CropIntent = new Intent("com.android.camera.action.CROP");
CropIntent.setDataAndType(cropImageUri, "image/*");
CropIntent.putExtra("crop", true);
CropIntent.putExtra("outputX", 200);
CropIntent.putExtra("outputY", 200);
CropIntent.putExtra("aspectX", 1);
CropIntent.putExtra("aspectY", 1);
CropIntent.putExtra("scale", true);
CropIntent.putExtra("return-data", true);
startActivityForResult(CropIntent, PERM_CODE);
} catch (ActivityNotFoundException ex){
}
}
Can anyone say how to get the output uri? Thanks.
If the cropped image is showing in an ImageView, follow this link to save it to device storage, then you can upload the file.

Gallery keep stopping error, after including Fileprovider for API 24 and above

After i updated the code to include Fileprovider for API 24 and above, i am getting the error "Gallery keeps stopping".
Below is the code segment for capturing image from camera and performing crop and saving it.
When i traced the code, it execute till startActivityForResult(cropIntent,3) in performcrop() then gives the above error. (Note: there is not much info in error dump, Tested on Nexus 7.0).
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_OK) {
return;
}
if (requestCode == 2)
{
Bundle extras = data.getExtras();
Bitmap var_Bitmap = (Bitmap) extras.get("data");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
var_Bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] bytes = stream.toByteArray();
try {
OutputStream out;
String root = Environment.getExternalStorageDirectory().getAbsolutePath()+"/";
File createDir = new File(root+"master"+File.separator);
createDir.mkdir();
File file = new File(root + "master" + File.separator +"master.jpg");
file.createNewFile();
out = new FileOutputStream(file);
out.write(bytes);
out.close();
path1=root + "master" + File.separator +"master.jpg";
//imageUri= Uri.fromFile(file);
if (Build.VERSION.SDK_INT > 23)
imageUri = FileProvider.getUriForFile(RecognizeActivity.this,
BuildConfig.APPLICATION_ID + ".provider",
file);
else
imageUri= Uri.fromFile(file);
} catch (IOException e) {
// e.printStackTrace();
}
performCrop();
} else if (requestCode==3)
{
Bundle extras = data.getExtras();
Bitmap var_Bitmap = (Bitmap) extras.get("data");
ImageView imageView1 = (ImageView) findViewById(R.id.ui_imageView_browse);
imageView1.setImageBitmap(var_Bitmap);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
var_Bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] bytes = stream.toByteArray();
try {
OutputStream out;
String root = Environment.getExternalStorageDirectory().getAbsolutePath()+"/";
File createDir = new File(root+"master"+File.separator);
createDir.mkdir();
File file = new File(root + "master" + File.separator +"master.jpg");
file.createNewFile();
out = new FileOutputStream(file);
out.write(bytes);
out.close();
path1=root + "master" + File.separator +"master.jpg";
} catch (IOException e) {
// e.printStackTrace();
}
ImageView imageView_error = (ImageView) findViewById(R.id.ui_imageView_error);
imageView_error.setVisibility(View.VISIBLE);
imageView_error.setImageResource(R.drawable.process);
userupdate();
if(netcheck==0)
{
FeedTask ft = new FeedTask();
ft.execute(path1);
}
}
}
public void performCrop() {
// take care of exceptions
try {
// call the standard crop action intent (the user device may not
// support it)
Intent cropIntent = new Intent("com.android.camera.action.CROP");
// indicate image type and Uri
cropIntent.setDataAndType(imageUri, "image/*");
// set crop properties
cropIntent.putExtra("crop", "false");
// indicate aspect of desired crop
cropIntent.putExtra("aspectX", 0);
cropIntent.putExtra("aspectY", 0);
// indicate output X and Y
cropIntent.putExtra("outputX", 300);
cropIntent.putExtra("outputY", 300);
// retrieve data on return
cropIntent.putExtra("return-data", true);
// start the activity - we handle returning in onActivityResult
startActivityForResult(cropIntent,3);
}
// respond to users whose devices do not support the crop action
catch (ActivityNotFoundException anfe) {
Toast toast = Toast
.makeText(this, "This device doesn't support the crop action!", Toast.LENGTH_SHORT);
toast.show();
}
}
As a work around , targetSdkVersion is set to 23 in manifest file and removed the Fileprovider path code segment and it is working fine.

Why I get defected image from ImageCropper( android wallpaper app)?

I am making android wallpaper app. At the start, I didn't use imagecropper and background image for android was very perfect. Then I wanted to add ImageCropper function and I noticed the problem: Image that I got from ImageCropper was very defected and bad quality. I am sure that the problem is here: (Performcrop method(starts activity for result))
public void performCrop(Uri picUri, Bitmap qq){
try {
utils = new Utils(getApplicationContext());
int height, width;
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
height = size.y;
width = size.x;
File f= new File(utils.saveImageToSDCard(qq));
f.createNewFile();
Intent cropIntent = new Intent("com.android.camera.action.CROP");
//indicate image type and Uri
cropIntent.setDataAndType(picUri, "image/*");
//set crop properties
cropIntent.putExtra("crop", "true");
//indicate aspect of desired crop
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
//indicate X and Y
cropIntent.putExtra("outputX", width);
cropIntent.putExtra("outputY", height);
//retrieve data on return
cropIntent.putExtra("return-data", true);
//start the activity - we handle returning in onActivityResult
cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, picUri.fromFile(f));
startActivityForResult(cropIntent, 1);
}
catch(ActivityNotFoundException anfe){
//display an error message
String errorMessage = "Whoops - your device doesn't support the crop action!";
Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
toast.show();
} catch (IOException e) {
e.printStackTrace();
}
}
OnActivityResult:
#Override
protected void onActivityResult(int requestCode,int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == 1) {
//get the cropped bitmap
if (data != null) {
Bundle extras = data.getExtras();
int height, width;
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
height = size.y;
width = size.x;
utils = new Utils(getApplicationContext());
Bitmap thePic = (Bitmap) (extras.getParcelable("data"));
Bitmap krutoi = Bitmap.createBitmap(thePic, 0, 0, width, height);
utils.setAsWallpaper(krutoi);
}
}
}
Here OnClick listener for SetWallpaperButton:
llDownloadWallpaper.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
utils = new Utils(getApplicationContext());
bitmap = ((BitmapDrawable) fullImageView.getDrawable())
.getBitmap();
utils.saveImageToSDCard(bitmap);
}
});
saveImageToSdCard(Utils.java):
public String saveImageToSDCard(Bitmap bitmap) {
File myDir = new File(
Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
pref.getGalleryName());
myDir.mkdirs();
Random generator = new Random();
int n = 10000;
n = generator.nextInt(n);
String fname = "Wallpaper-" + n + ".jpg";
File file = new File(myDir, fname);
if (file.exists())
file.delete();
try {
FileOutputStream out = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
out.close();
Toast.makeText(
_context,
_context.getString(R.string.toast_saved).replace("#",
"\"" + pref.getGalleryName() + "\""),
Toast.LENGTH_SHORT).show();
Log.d(TAG, "Wallpaper saved to: " + file.getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(_context,
_context.getString(R.string.toast_saved_failed),
Toast.LENGTH_SHORT).show();
}
return file.getAbsolutePath();
}
setAsWallpaper(Utils.java):
public void setAsWallpaper(Bitmap bitmap) {
try {
WallpaperManager wm = WallpaperManager.getInstance(_context);
wm.setBitmap(bitmap);
Toast.makeText(_context,
_context.getString(R.string.toast_wallpaper_set),
Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(_context,
_context.getString(R.string.toast_wallpaper_set_failed),
Toast.LENGTH_SHORT).show();
}
}

Camera Activity not returns path of image

I have task to capture image from camera and send that image to crop Intent. following is the code i have written
for camera capture
Intent captureIntent = new Intent(
MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(captureIntent, CAMERA_CAPTURE);
In on Activity result
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == CAMERA_CAPTURE) {
// get the Uri for the captured image
picUri = data.getData(); // picUri is global string variable
performCrop();
}
}
}
public void performCrop() {
try {
Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.setDataAndType(picUri, "image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("aspectX", 3);
cropIntent.putExtra("aspectY", 2);
cropIntent.putExtra("outputX", 256);
cropIntent.putExtra("outputY", 256);
cropIntent.putExtra("return-data", true);
startActivityForResult(cropIntent, CROP_PIC);
} catch (ActivityNotFoundException anfe) {
String errorMessage = "Your device doesn't support the crop action";
Toast toast = Toast.makeText(getApplicationContext(), errorMessage,
Toast.LENGTH_SHORT);
toast.show();
}
}
I am getting different behaviours on different devices
In some devices i am getting error "couldn't find item".
In some devices after capturing image activity stuck and doesn't go ahead
I have also tried this
Please tell me the Right way to do this
You can by calling the intent like below:
int REQUEST_IMAGE_CAPTURE = 1;
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File f = new File(android.os.Environment.getExternalStorageDirectory(), "temp.jpg");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
((Activity) context).startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);
And in your activity inside OnActivityResult you get the path like this:
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_IMAGE_CAPTURE) {
File f = new File(Environment.getExternalStorageDirectory().toString());
for (File temp : f.listFiles()) {
if (temp.getName().equals("temp.jpg")) {
f = temp;
break;
}
}
try {
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
Bitmap bitmap = BitmapFactory.decodeFile(f.getAbsolutePath(),
bitmapOptions);
Matrix matrix = new Matrix();
matrix.postRotate(-90);
Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
rotatedBitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] attachmentBytes = byteArrayOutputStream.toByteArray();
String attachmentData = Base64.encodeToString(attachmentBytes, Base64.DEFAULT);
String path = android.os.Environment
.getExternalStorageDirectory()
+ File.separator
+ "CTSTemp" + File.separator + "default";
f.delete();
ESLogging.debug("Bytes size = " + attachmentBytes.length);
ESLogging.debug("FilePath = " + path);
OutputStream outFile = null;
File file = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
try {
outFile = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 85, outFile);
outFile.flush();
outFile.close();
} catch (FileNotFoundException e) {
ESLogging.error("FileNotFoundException while uploading new attachment in class HomeActivity", e);
e.printStackTrace();
} catch (IOException e) {
ESLogging.error("IOException while uploading new attachment in class HomeActivity", e);
e.printStackTrace();
} catch (Exception e) {
ESLogging.error("Exception while uploading new attachment in class HomeActivity", e);
e.printStackTrace();
}
} catch (Exception e) {
ESLogging.error("Exception while uploading new attachment in class HomeActivity", e);
e.printStackTrace();
}
}
}
}
//Declare this in class
private static int RESULT_LOAD_IMAGE = 1;
String picturePath="";
// write in button click event
Intent i = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, RESULT_LOAD_IMAGE);
//copy this code in after onCreate()
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK
&& null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
picturePath = cursor.getString(columnIndex);
cursor.close();
ImageView imageView = (ImageView) findViewById(R.id.img); //place imageview in your xml file
imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
}
}
write the following permission in manifest file
1.read external storage
2.write external storage
try this tutorial http://www.androidhive.info/2013/09/android-working-with-camera-api/ this will help you

Android crop image size

I have the following code for users to crop image. When I set the size beyond 256, it does not work. My gut feel is "cropIntent.putExtra("return-data", true);" causing the error. How do I pass in the uri to cropIIntent and retrieve out from onActivityResults? In another words, save the image after crop and retrieve.
private void performCrop() {
try {
//call the standard crop action intent (the user device may not support it)
Intent cropIntent = new Intent("com.android.camera.action.CROP");
//indicate image type and Uri
cropIntent.setDataAndType(mImageCaptureUri, "image/*");
//set crop properties
cropIntent.putExtra("crop", "true");
//indicate aspect of desired crop
cropIntent.putExtra("aspectX", 4);
cropIntent.putExtra("aspectY", 3);
//indicate output X and Y
cropIntent.putExtra("outputX", 256);
cropIntent.putExtra("outputY", 256);
//retrieve data on return
cropIntent.putExtra("return-data", true);
startActivityForResult(cropIntent, PIC_CROP);
} //respond to users whose devices do not support the crop action
catch (ActivityNotFoundException anfe) {
//display an error message
String errorMessage = "Your device doesn't support the crop action!";
Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
toast.show();
}
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PIC_CROP) {
try {
final TextView imgTv = (TextView) findViewById(R.id.imageInfo);
Bundle extras = data.getExtras();
thumbnail = extras.getParcelable("data");
ImageView image = (ImageView) findViewById(R.id.pestImage);
image.setImageBitmap(thumbnail);
File f = new File(mImageCaptureUri.getPath());
if (f.exists()) {
f.delete();
}
}
}//end onactivity results
private void performCrop() {
try {
//call the standard crop action intent (the user device may not support it)
Intent cropIntent = new Intent("com.android.camera.action.CROP");
//indicate image type and Uri
cropIntent.setDataAndType(mImageCaptureUri, "image/*");
//set crop properties
cropIntent.putExtra("crop", "true");
//indicate aspect of desired crop
cropIntent.putExtra("aspectX", 4);
cropIntent.putExtra("aspectY", 3);
//indicate output X and Y
cropIntent.putExtra("outputX", 800);
cropIntent.putExtra("outputY", 800);
File f = new File(Environment.getExternalStorageDirectory(),
"/temporary_holder.jpg");
try {
f.createNewFile();
} catch (IOException ex) {
Log.e("io", ex.getMessage());
}
uri = Uri.fromFile(f);
cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult(cropIntent, PIC_CROP);
} //respond to users whose devices do not support the crop action
catch (ActivityNotFoundException anfe) {
//display an error message
String errorMessage = "Your device doesn't support the crop action!";
Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
toast.show();
}
}
onActivityResult
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PIC_CROP) {
String filePath = Environment.getExternalStorageDirectory()
+ "/temporary_holder.jpg";
thumbnail = BitmapFactory.decodeFile(filePath);
//thumbnail = BitmapFactory.decodeFile(filePath);
// Log.i("",String.valueOf(thumbnail.getHeight()));
ImageView image = (ImageView) findViewById(R.id.pestImage);
image.setImageBitmap(thumbnail);
}}
Try
Uri cropedImageUri = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(cropedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String filePath = cursor.getString(columnIndex);
cursor.close();
Now filePath is the path to cropped image
To load bitmap from filePath Use
private Bitmap loadImageFromSDCard(String filePath) {
BitmapFactory.Options bfo = new BitmapFactory.Options();
bfo.inSampleSize = 1;
bfo.outWidth = 100;
bfo.outHeight = 100;
Bitmap photo = BitmapFactory.decodeFile(filePath, bfo);
return photo;
}
if (android.os.Build.VERSION.SDK_INT > 10){
Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.setDataAndType(picUri, "image/*");
cropIntent.putExtra("crop", "true");
int gcd = BigInteger.valueOf(ImageWidth).
gcd(BigInteger.valueOf(ImageHeight)).intValue();
cropIntent.putExtra("aspectX", (ImageWidth / gcd));
cropIntent.putExtra("aspectY", (ImageHeight / gcd));
cropIntent.putExtra("outputX", ImageWidth); // X
cropIntent.putExtra("outputY", ImageHeight); // Y
cropIntent.putExtra("return-data", true);
cropIntent.setData(picUri);
startActivityForResult(cropIntent, PIC_CROP_INTENT_ID);
}

Categories

Resources