Reputation: 4403
I have an AlertDialog appear whenever I find that the device location has changed. This happens pretty much at anytime the application sees fit.
The problem is that if the dialog appears just before a new Activity is started the dialog disappears with the old Activity. Is there anyway to have the AlertDialog block new Intents? Or translate over to the new Activity (could I update the Context)?
I noticed that AlertDialogs don't even handle the case where the device rotates, so my hope for this isn't too high, but any input would help.
Upvotes: 0
Views: 408
Reputation: 6653
Your question is not clear for me,As I understood you need to show a Alertdialog whenever the device location is changed that too above a new activity.My suggestion is that when ever the device location changes get the need values,bundle it with the intent and pass it starting a new activity.With the bundle also pass a boolean flag.If the boolean flag is true in the new activity show a Alertdialog box in onCreate
,I hope you will get what you wanted.This will be the best scenario for you to do this as I understood.Also keeping the history of these activity's may affect the app while implementing this.
Upvotes: 0
Reputation: 652
I would simply use a SharedPreference setting and check it whenever your potentially interruptive Activity starts.
Ex;
Again, an AlertDialog is meant to attach itself to an activity, so you really can't stop it from dieing, if your previous activity is pushed back or loses focus of the screen (ui thread basically put on hold!)
Hope you can fix your problem with this minor fixup.
To add what Daniel commented, Custom toasts can be awesome. They are, however, limited to about 3.5 seconds (I think) More on Custom Toasts; http://developer.android.com/guide/topics/ui/notifiers/toasts.html#CustomToastView
Upvotes: 2