Hi,

I have some background task that is lengthy, long enough that it will
see the passing of several activities. When finished, I need to prompt
the user for some input. Is there a best-practice for keeping a
'foreground' context so I can launch an alert dialog from whichever
context is currently being shown? I can do something like this:

  public class ContextReference {
      private static ContextReference mInstance;
      private Context mContext;

      public void onActivityResume(Context context) {
          mContext = context;
      }

      public void onActivityPause() {
          mContext = null;
      }

      public Context getContext() {
          return mContext;
      }
  }

then override every onResume()/onPause() pair in all activities in my
application, have them each call the corresponding methods, this
doesn't seem like a good idea though. Is there a specialized
notification class for this sort of thing?  I also tried using a
context stored at startup from getApplicationContext(), but when I try
to use it with alert builder sometime into the life of my app, it
appears to not work,

Thanks

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