4

My application needs to open the gallery and pick an image to crop. I set the target size as a value(87%*screenWide). Now, problems occur. In large screen devices, the gallery failed to return the cropped image and the log said "!!! FAILED BINDER TRANSACTION !!!". In most of the devices, it is OK.

Can any one help me for this? Thanks!

I use Intent.ACTION_GET_CONTENT to crop, and set the outputX, outputY etc. It's routine to crop images.

1
  • can you check the logcat and say what tyhe exact stack trace ? i have a hunch that somewhere along the way you get out of memory error due to the problem android has with large Bitmaps. Dec 23, 2010 at 13:02

3 Answers 3

7

I ran into a similar problem. If you're using Android's default cropping tool, it has a 256x256 max crop size limitation. Set the size of your crop to smaller or equal to that and you'll be fine.

intent.putExtra("outputX", 256);
intent.putExtra("outputY", 256);
6

Try sending the intent as below:

mSavedUri = Uri.fromFile(new File("/sdcard/cropped.jpg"));

mImageSelectIntent = new Intent(Intent.ACTION_GET_CONTENT, null);
mImageSelectIntent.setType("image/*");
mImageSelectIntent.putExtra("crop", "true");
mImageSelectIntent.putExtra("aspectX", 4);
mImageSelectIntent.putExtra("aspectY", 3);
mImageSelectIntent.putExtra("outputX", mImageWidth);
mImageSelectIntent.putExtra("outputY", mImageHeight);
mImageSelectIntent.putExtra("output", mSavedUri);

The cropped image will be saved as a cropped JPG and not returned to you via "data".

1
1

Re the wallpaper problem, try setting explicitly:

your_intent.putExtra("setWallpaper", false);
1
  • Thank you very much for your reply. In fact, it doesn't take effect, because I've set it. Some users are still reporting this problem. I am sure they are using the latest version. I don't know how to solve it except complaining that there are some many androids in the world.
    – Henry Sou
    Aug 20, 2011 at 14:07

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.