Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps
The best workaround I found was to use setImageURI
on the ImageView
objects using
remoteViews.setUri(R.id.myImageView, "setImageURI", "file://blahblahblah.png");
Here is the full discussion from Android Developers group
Failed Binder Transaction is Ruining Entire Widget
PackageManager
methods, like getInstalledPackages()
, can result in a binder transaction error, if the sum total of information being returned is greater than 1MB.
One way to mitigate this is to pass in no flags (e.g., skip PackageManager.GET_ACTIVITIES
) to reduce the amount of data in the first call. Then, for those packages where you need the additional detail, call getPackageInfo()
to get the details for a specific package. While this does involve multiple IPC round-trips, and therefore is slower, it will help prevent you from blowing out the 1MB-per-transaction limit.
FAILED BINDER TRANSACTION with both bitmap or bytearray
How can I pass the image data between activities?
You don't. Either:
These should be combined into one activity, or
You should have some sort of image cache that the two activities share, where you pass the identifier to the cache entry
Still get error FAILED BINDER TRANSACTION although have compressed it
I think you are not compressing the bmp where you should do it.
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent returnIntent = new Intent();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] bytes = stream.toByteArray();
returnIntent.putExtra("BMP", bytes);
setResult(Activity.RESULT_OK, returnIntent);
finish();
}
});
Then you should to uncompress where you need to show the image
byte[] bytes = data.getByteArrayExtra("BMP");
Bitmap bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
imageView.setImageBitmap(bmp);
Related Topics
How to Add Window -- Token Android.Os.Binderproxy Is Not Valid; Is Your Activity Running
Sliding Drawer Appear in All Activities
First Launch Take Long Time (Classloader Referenced Unknown Path)
How to Clear an Imageview in Android
Sha1 Key for Debug & Release Android Studio MAC , How to Generate Sha1 Release Keys in MAC
Check If Correct Google Play Service Available: "Unfortunately Application Has Stopped Working"
How to Style the Drawerarrowtoggle from Android Appcompat V7 21 Library
How to Automatically Add Thousand Separators as Number Is Input in Edittext
Android App Crashing (Fragment and Xml Onclick)
Creating Tabs Using Fragments Now That Tabactivity Is Deprecated
Android Setting with Textview for Hebrew Text
How to Get Sms Sent Confirmation for Each Contact/Person in Android
Coupling Firebaserecyclerviewadapter to a Boolean/String Map.Entry
Loading Youtube Video Through Iframe in Android Webview
Place 2 Textview Beside Each Other with 2Nd Textview Always Visible