Question

When I first add the widget on the screen, it works with no error, and then when I clicked the button on the widget to go into the activity and close it. The widget stops updating and shows this error

12-19 19:14:52.370: E/JavaBinder(14805): !!! FAILED BINDER TRANSACTION !!!

here is my code:

Widget4x2.remoteViews.setProgressBar(R.id.widget_progressbar, 100, (int)(NowPlayingService.progress * 100), false);
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(Widget4x2.context);
appWidgetManager.updateAppWidget(new ComponentName(Widget4x2.context,Widget4x2.class), Widget4x2.remoteViews);

Are there any problems with the code?

Was it helpful?

Solution

I guess Widget4x2.remoteViews is a static variable. It is likely the static variable hasn't been assigned, or it is not properly initiated.

OTHER TIPS

When you call setters (like setProgressBar) on RemoteViews, it does not make chages to views directly. Instead, it stores sequence of such chages (called actions) and serializes them to send them to notification or widget manager.

As you are using static variable to store RemoteViews object, list of actions associated with remoteViews grows infinitely as you update remoteViews. This stops when the size of serialized remoteViews reaches 1Mb, which is maximum payload size for binder transaction.

There is no way to clear or deduplicate list of actions, so recreating RemoteViews is a solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top