While programming for Android I already figured out a lot of things that are really different compared to other platforms. It’s not only the api that’s new, it’s also a way of programming. Some things are connected in a way I’ve never seen before or it wasn’t important for me at all. Sometimes this brings up strange reactions of the system or problems. Often it’s hard to find solutions for these things and that’s why I decided to keep on posting my experiences here. Maybe they’ll be helpful for some other people out there
Last week I was working on appazaar and implemented a new feature for the upcoming release. While testing everything seemed fine so I installed the app on my device and used it the way I’d expect other users to do. Well, basically I used my phone the normal way and appazaar from time to time
Anyway, after a while the widget always stopped updating itself so I started debugging and found a message saying “Java Binder Transaction Failed“. So I started looking for it on Google and found lots of people having the same message in different situations. Sadly most of them didn’t talk about a solution but at some point I found a post on the Android Developers Blog. Basically the problem is about recursive references that come up easily if you try to create “fast” code. The article is describing the problem pretty good so I won’t go into that any deeper but here’s some of what killed my app:
Considering the fact that there’s a background service updating the widget under special circumstances, I used some static variables for stuff the service was using at least during every update. Actually that’s fast code but as mentioned in the article:
This code is very fast and also very wrong.
So I changed some class-variables to local ones inside of functions et voilà : Problems solved
Here’s another post explaining a bit about it: AppWidgets: Reusing RemoteViews instance leaks memory?
By the way, to get notified about new posts, just enter your email address on the right