Crop Image On Different Devices
I want to take a picture with the camera and crop it. This works great (with the second code) on newer devices with this code I found on the community wiki: Intent intent = new Int
Solution 1:
Some devices don't support cropping, meaning that their gallery application does not have it built it. The best solution is building a cropping mechanism into your app. Here is a good open source cropper:
Solution 2:
I found a better code for this problem. This here will search for apps which are able to crop images and start the first that is found. Hope that help someone.
IntentcropApps=newIntent("com.android.camera.action.CROP");
cropApps.setType("image/*");
List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(cropApps, 0);
intsize= list.size();
if (size == 0)
{
Toast.makeText(context, "Can not find image crop app", Toast.LENGTH_SHORT).show();
returnnull;
}
else
{
ResolveInfores= list.get(0);
Intentintent=newIntent();
intent.setClassName(res.activityInfo.packageName, res.activityInfo.name);
intent.setData(imageCaptureUri);
intent.putExtra("outputX", 96);
intent.putExtra("outputY", 96);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
startActivityForResult(intent, CROP_FROM_CAMERA);
}
Post a Comment for "Crop Image On Different Devices"