Re: [android-beginners] Re: Coordinating Activity life cycle with Service life cycle

2010-07-24 Thread Justin Anderson
That is interesting... I've never actually used the ServiceConnection class so I don't know if it would cause leaks or not. -- There are only 10 types of people in the world... Those who know binary and those who don't. --

[android-beginners] Re: Coordinating Activity life cycle with Service life cycle

2010-07-12 Thread Bret Foreman
Yeah, I've read this article before. But note this quote: "If the object you pass is for some reason tied to the Activity/ Context, you will leak all the views and resources of the activity. This means you should never pass a View, a Drawable, an Adapter, etc." I believe a ServiceConnection objec

Re: [android-beginners] Re: Coordinating Activity life cycle with Service life cycle

2010-07-12 Thread Justin Anderson
*> An interesting related problem is that rotating the screen causes my Activity to be destroyed and (re)created in quick succession.* This is done by design. You can find a few tips about how to program with this in mind here: http://developer.android.com/resources/articles/faster-screen-orienta

[android-beginners] Re: Coordinating Activity life cycle with Service life cycle

2010-07-12 Thread Bret Foreman
An interesting related problem is that rotating the screen causes my Activity to be destroyed and (re)created in quick succession. This means that the service unbind, bind, and unbind are called rapidly too. And that seems to cause a null pointer exception inside the bind/ unbind logic somewhere. I

[android-beginners] Re: Coordinating Activity life cycle with Service life cycle

2010-07-12 Thread Bret Foreman
In fact, I believe I've found a bug. After calling unbindService on an active service connection, ServiceConnection.onServiceDisconnected is never called. This means I can't tell when the service has been destroyed. That makes for rather convoluted logic in trying to manage the state of the Compoun