[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread mobilekid
Thanks Stoyan, Is it a case of declaring the activity with android:configChanges in the AndroidManifest.xml, and then implementing what to reload in the onConfigurationChanged(Configuration) of that particular activity? On Mar 11, 11:23 am, Stoyan Damov stoyan.da...@gmail.com wrote: It's not

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread mobilekid
For some reason that seems not to work in my case. I've declared the activity as android:configChanges=orientation in the AndroidManifest.xml, which I assume will call onConfigurationChanged (Configuration). So for testing purposes I've simply implemented it as follows: @Override public void

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread Stoyan Damov
keyboardHidden|orientation On Wed, Mar 11, 2009 at 2:34 PM, mobilekid mobilek...@googlemail.com wrote: For some reason that seems not to work in my case. I've declared the activity as android:configChanges=orientation in the AndroidManifest.xml, which I assume will call

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread Marco Nelissen
That will solve the problem when opening/closing the keyboard, but won't solve it when e.g. starting the app and then immediately hitting the back button to exit it. On Wed, Mar 11, 2009 at 5:37 AM, Stoyan Damov stoyan.da...@gmail.com wrote: keyboardHidden|orientation On Wed, Mar 11, 2009

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread mobilekid
Sweet! Thank you! On Mar 11, 12:37 pm, Stoyan Damov stoyan.da...@gmail.com wrote: keyboardHidden|orientation --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread Stoyan Damov
unless he traps the back button in onKeyDown On Wed, Mar 11, 2009 at 2:51 PM, Marco Nelissen marc...@android.com wrote: That will solve the problem when opening/closing the keyboard, but won't solve it when e.g. starting the app and then immediately hitting the back button to exit it. On

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread Streets Of Boston
I've been dealing with the same issues and i tried all these. And nothing seems to work well. First of all, having a thread that's part of your activity running after your activity's onDestroy has been called is tricky. It can lead to memory-leaks, etc. I finally decided to create a Service for

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread Marco Nelissen
Sure, but then what if right as the activity is starting, something else happens that causes it to be destroyed? (incoming phone call, camera app is started, it could be anything, really) My point was: instead of putting in all these hacks to try and prevent your activity from being stopped and

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread Dianne Hackborn
Yes, a Service is what you want to use if you want to continue doing work after the user has exiting your app. The original poster I think is dealing with thread that are just supposed to be running while the app is being used, in which case I would avoid using a Service, since that is likely to

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread Timo Bruck
Dianne... instead of making a Handler subclass, would it be just as effective to have the Handler be a field of a custom Thread class which is reset by a dying activity instance in onRetainNonConfigurationInstance() and set by the new activity instance in onCreate()? Instead of retaining the

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread Timo Bruck
Answering my own question, I think the answer is that Dianne's way is better than mine. With Dianne's way, if the thread completes while the Activity is being destroyed/created, there's still a Handler around to post a message to. When the new Activity is created, it'll get the message that was

[android-developers] Re: Issue with Threads and onCreate()

2009-03-11 Thread Dianne Hackborn
Yep, it's easier to take advantage of Handler to deal with a lot of the threading grunginess for you. On Wed, Mar 11, 2009 at 4:13 PM, Timo Bruck timot...@gmail.com wrote: Answering my own question, I think the answer is that Dianne's way is better than mine. With Dianne's way, if the