Piren,
Thanks for your answer.  After reading up on the Observer pattern as you 
suggested, I ended up using propertyChange listener.  It seems to be a 
handy conduit to trigger an event in an activity from a broadcast receiver.
Thanks,
Gary

On Sunday, July 28, 2013 11:41:21 PM UTC-7, Piren wrote:
>
> An Activity, like BroadcastReceiver is a class, so you've done it before. 
> You just did it using existing mechanisms that make it simpler for you.
>
> You should read up on how to use BroadcastReceiver to send messages (it 
> can listen to whatever you want), though the LocalBroadcastReceiver should 
> be used instead.
> You can also read up on the more general Observer Pattern and how to 
> implement it.
>
> On Monday, July 29, 2013 2:30:12 AM UTC+3, Gary Blakely wrote:
>>
>> I have a class named SMSReceiver that extends BroadcastReceiver.  I 
>> instantiate an object of this class from the onCreate event in 
>> mainActivity.  SMSReceiver listens for stuff and when it finds what it 
>> wants it needs to send a data message back to the Activity and trigger some 
>> event in the activity that will handle it.  SMSReceiver has to stay 
>> instantiated as long as the app is running.
>>
>> I've googled around all over but can't seem to find anything that works. 
>>  I have done a lot of messaging between services and activities but never 
>> from a class back to the activity that instantiated it.  I see a lot of 
>> info on using intents to do this but nothing that would accomplish what I 
>> need to do.
>>
>> What is the best way to accomplish this?
>> Thanks,
>> Gary
>>
>>

-- 
-- 
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
--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to