Change Google’s intent for Android

I have created an example cropping application and I call the built-in intent crop .

Here is my code:

 Intent intent = new Intent("com.android.camera.action.CROP"); intent.setType("image/*"); intent.setData(mImageCaptureUri); intent.putExtra("outputX", 200); intent.putExtra("outputY", 200); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("scale", true); intent.putExtra("return-data", true); 

How to change the cropping area according to user input?

0
source share
2 answers

Yes, you can change outputX / outputY and aspectX / aspectY to suit your needs. See also

0
source

Just remove the output options / aspect / scale.

 Intent intent = new Intent("com.android.camera.action.CROP"); intent.setType("image/*"); intent.setData(mImageCaptureUri); intent.putExtra("return-data", true); 

If this does not give you the result you want, try adding some of these options again, but not all.

Attention! This action is not supported on all devices, so you should also check the ActivityNotFoundException when starting the operation, find an alternative way to crop on these devices, or ask the user to install an application for this, such as QuickPic.

0
source

Source: https://habr.com/ru/post/988022/


All Articles