When you change orientation your Activity is destroyed and then re-
created.  When you re-create the dialog view object that was sent to
the background process is no longer valid, thus the error.

There are probably several ways to handle this but the first that
comes to my mind is:

1) The background thread should not be trying to manipulate views
directly.  Have it send a 'cancel' message to a handler in one of your
UI classes (like the main activity).  The UI class can then take the
appropriate action to cancel the dialog.

2) If orientation can change while you have the dialog up (which it
can), then you need to save that state when the activity is stopped
and have your restart handler take care of recreating the dialog and
displaying it when the activity is restarted (after orientation
change).

Your message handler should then take the cancel message from the
background thread and dismiss the dialog if it exists.

Hope this helps,

Greg
--~--~---------~--~----~------------~-------~--~----~
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