I figured it out.

If you have the Activity register the BroadcastReceiver
programatically (ie, not in the manifest file), the Activity can have
a reference to the BroadcastReceiver.  Then you can give the Activity
a listener interface and register it with the BroadcastReceiver.  So
instead of having the BroadcastReceiver fire an Intent, it just calls
the callback on the Activity.  You may have to set up a Runnable and
call runOnUiThread() on the Activity, but it works just fine.

-Cormac

On Feb 25, 5:53 pm, Cormac McCarty <[email protected]> wrote:
> Hi all,
>
> Is it possible to update a currently running activity from a 
> BroadcastReceiver?
>
> I have a BroadcastReceiver that's able to start an activity just fine
> from its onReceive method.  But what if the activity is already
> running?  How do I let it know that the BroadcastReceiver has some
> more data for it?  Do I just start the activity again?  If so, would
> that be a new instance of the activity?  What happens to the old one?
> If it doesn't create a new instance, does onCreate get called again?
> If not, how does the activity know that it's been hit again by the
> BroadcastReceiver?  More importantly, in that case, how does the
> activity get the data I attached to the intent in the
> BroadcastReceiver?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to