Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Failed to unparcel Bitmap error on Honeycomb
    primarykey
    data
    text
    <p>I have an application that allows the user to go to the photo gallery and select a photo to use as an avatar. The code works fine everywhere except for the Xoom, which fires up the gallery, allows the user to select the photo and then fails with a "java.lang.RuntimeException: Failed to unparcel Bitmap". I'm using the following method to call for the gallery:</p> <pre><code>public Intent getImagePickerIntent(int width, int height) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); intent.putExtra("crop", "true"); intent.putExtra("outputX", width); intent.putExtra("outputY", height); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("scale", true); intent.putExtra("noFaceDetection", true); intent.putExtra("setWallpaper", false); intent.putExtra("return-data", true); return intent; } </code></pre> <p>And then I'm getting the Bitmap data out using the following code:</p> <pre><code>@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == PHOTO_PICKED) { // If the activity successfully captured a photo if(resultCode == Activity.RESULT_OK &amp;&amp; data.getExtras() != null) { // Resize photo to 100x100 and then save to user's device try { // putting this in a try-catch after seeing odd exceptions on a Xoom ImageHelper.save(PrefsActivity.this, MyApplication.DEVICE_PHOTO_FILE_NAME, ImageHelper.resize((Bitmap)data.getExtras().getParcelable("data"), 100, 100)); </code></pre> <p>Note that I'm getting the Bitmap by calling <code>(Bitmap)data.getExtras().getParcelable("data")</code></p> <p>This works fine on Android 2.3 and below, Any idea why it is failing in 3.x?</p> <p><strong>EDIT</strong>: To make it more exciting, this same code works fine on Honeycomb in a regular Activity. This particular issue is occurring in a PreferencesActivity.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload