how to set the output image use com.android.camera.action.CROP
- by adi.zean
I have code to crop an image, like this :
public void doCrop(){
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setType("image/");
List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent,0);
int size = list.size();
if (size == 0 ){
Toast.makeText(this, "Cant find crop app").show();
return;
} else{
intent.setData(selectImageUri);
intent.putExtra("outputX", 300);
intent.putExtra("outputY", 300);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
if (size == 1) {
Intent i = new Intent(intent);
ResolveInfo res = list.get(0);
i.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
startActivityForResult(i, CROP_RESULT);
}
}
}
public void onActivityResult (int requestCode, int resultCode, Intent dara){
if (resultCode == RESULT_OK){
if (requestCode == CROP_RESULT){
Bundle extras = data.getExtras();
if (extras != null){
bmp = extras.getParcelable("data");
}
File f = new File(selectImageUri.getPath());
if (f.exists()) f.delete();
Intent inten3 = new Intent(this, tabActivity.class);
startActivity(inten3);
}
}
}
from what i have read, the code intent.putExtra("outputX", 300); intent.putExtra("outputY", 300); is use to set the resolution of crop result, but why i can't get the result image resolution higer than 300x300? when i set the intent.putExtra("outputX", 800); intent.putExtra("outputY", 800); the crop function has no result or crash, any idea for this situation?
the log cat say "! ! ! FAILED BINDER TRANSACTION ! ! !