Reputation: 356
I got the !!! FAILED BINDER TRANSACTION !!!
error when putting a scaled Bitmap
as Base64
String
into a HashMap
and sending the map as Intent to called Activity
.
@Override
protected Void doInBackground(byte[]... params) {
byte[] bytes = params[0];
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options);
int imgHeight = options.outHeight;
int imgWidth = options.outWidth;
if (imgHeight > 1920) imgHeight = 1024;
if (imgWidth > 1080) imgWidth = 768;
options.inJustDecodeBounds = false;
options.inSampleSize = 8;
image = Bitmap.createScaledBitmap(BitmapFactory.decodeByteArray(bytes,0,bytes.length,options), imgWidth, imgHeight, false);
Items.put("image", base64EncodeDecode.encodeToBase64(image));
And here is the onClick
method that finish this Activity
.
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent returnIntent = new Intent();
returnIntent.putExtra("Map", Items);
returnIntent.putExtra("returncode", SAVE_CODE);
setResult(RESULT_OK, returnIntent);
finish();
}
Some Information:
Items = HashMap<String,String>
If I set the line Items.put("image", base64EncodeDecode.encodeToBase64(image));
in comments, everything works.
What could be the problem?
I hope someone can help me.
Kind Regards!
Upvotes: 0
Views: 1176
Reputation: 166
I had come with the same issue a few weeks back. so i stored the bitmap in phone file system and passed the file path to the intent. On the other hand i just retrieved the file. You might have to use async task while writing to the bitmap to file system.
Upvotes: 2