You need to implement the method
 public void onConfigurationChanged(Configuration arg0)
    {
            super.onConfigurationChanged(arg0);
    }

in your activity. and in manifest file, you have to the statement
android:configChanges="keyboardHidden|orientation" for that activity.

so when your screen orientation is changed, it wont call the onCreate
() method again.

On Sep 26, 1:21 pm, Kacper86 <cpph...@gmail.com> wrote:
> Hi!
>
> I've created ProgressDialog with a second thread according to the
> DevGuide:
>    http://developer.android.com/guide/topics/ui/dialogs.html#ProgressDialog
> It works great till user:
>
> 1) changes screen orientation or
> 2) hits the back button twice (first to hide the dialog, second to
> hide the app) to hide the application and run the app again after a
> while.
>
> Then, onCreate() is called (for the second time), and progress bar
> stops responding properly. My thread may work for a few minutes and I
> want to give the user possibility to hide it and do sth else. After a
> while he might want to run the app again in order to check the
> progress.
>
> I found a few articles concerning this topic, but I couldn't find the
> exact solution I should chose for this problem. So, could you tell mi
> what is the proper way to handle this? Should i save the handler and
> dialog state with "onRetainNonConfigurationInstance()"? If so, how to
> do it properly and is it safe?
>
> Or maybe my solution is wrong and I should create service, which
> spawns the thread and communicates with activity (progress bar) with
> AIDL?  But this will mean that the article in DevGuide is wrong, cause
> it doesn't give a long term solution for creating a progress bar...
>
> I'm stuck, and I'd appreciate all the response!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to