Thank you for your response! It works great - now I can change the
orientation and the ProgressDialog works. And do have any ideas how to
solve the problem with user hitting "back" or "home" button? I found
that you may set your Dialog with Dialog#setCancelable(false). Then,
the user can only hit "home" button, and when he launches the app
again, ProgressDialog is still there!

However, what should be done if I want Dialog that can be cancelable?
So that the user can cancel ProgressDialog, set something in the app
settings, hit "home" button, run sth else, and then relaunch my app to
check the progress?

On Sep 26, 11:36 am, manoj <[email protected]> wrote:
> 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to