Tuesday, May 7, 2013

[android-developers] Re: Need help with background loading

I'm not sure you fully understand what my solution is...
Instead of figuring out ways how to get Activity B (or any of your other existing activities) to show the dialog (it can be done of course) i'm suggesting instead to show it in a whole new activity, Activity C.

The idea behind is it that if you have 10 activities, you can either add code in all 10 of them to make it work (which is a hassle and kinda stupid :-P ), or just add one activity with the purpose of showing the dialog... that means it doesn't matter what activity the user is currently in.

If you're hell bent on doing it the hard way, you can implement the Observer pattern and add listeners to all the activities that need to display that dialog. Also don't forget to add code to show the dialog in case the loader finished before there was an active listener and don't forget to synchronize the Register function to prevent it from dispatching while you're changing the listeners.

On Tuesday, May 7, 2013 4:52:38 PM UTC+3, MathieuB wrote:
Thanks for the reply!

That works, indeed, but what I really wanted to achieve was to show the alertDialog even if the user is not in the launcher activity anymore. 

For example : 

In home activity (Activity A), I start the loader. The onLoadFinished is not yet called and the user goes in another activity (Activity B). When the loader from Activity A finishes, the alertDialog would show in Activity B because that's where the user is now.

Is that possible?

--
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment