I have a problem with starting an intent from a BroadcastReceiver,
where everytime onReceive() is called from the BroadcastReceiver it
starts an intent which loads an activity.  My problem is every time it
seems to start a new instance of the Acitivty (even if it is already
running) and I would like it to be a singleton.  The problem this
causes is that after a few calls of onReceive(), if the user hits the
back button on the app, they are presented with what sees to be the
same activity multiple times.

Here is the basics of what I am doing:

public class MyReceiver extends BroadcastReceiver
{

        @Override
        public void onReceive(Context context, Intent intent)
        {
                try
                {

                        Intent iAlarm = new Intent( context, MyActivity.class );
                        iAlarm.addFlags(Intent.FLAG_FROM_BACKGROUND);
                        iAlarm.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        context.startActivity(iAlarm);
                }
                catch( Exception e )
                {
                        .....
                }
        }

}


Any pointers would be appreciated, and thanks for your help in
advance.

Thanks,
Chuck

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to