Aha. So I will do something like this in the BroadcastReceiver:

  myIntent.putExtra("x","y");
  myActivity.startActivity(myIntent);

And then in myActivity.onCreate() do something like:

  DoSomething(myBundle.getBundleExtra("x"));

Does that look about right?

If so, how do I tell, in onCreate(), whether the Activity was started by the
user or by my BroadcastReceiver?

Thanks a lot,

Anders Feder

2009/10/5 Justin Anderson <janderson....@gmail.com>

> Use Intent.putExtra() to add the data you want to pass to the activity you
> are starting.  There are several different versions of putExtra depending on
> the data you want to pass.
>
> Then the activity you are starting can get that information from the bundle
> that is passed in via onCreate().
>
> I have never actually done this, but I believe that is how it happens... If
> I am wrong, could somebody please correct me?
>
> Thanks,
> Justin
>
> ----------------------------------------------------------------------
> There are only 10 types of people in the world...
> Those who know binary and those who don't.
> ----------------------------------------------------------------------
>
>
>
> On Mon, Oct 5, 2009 at 9:16 AM, Anders Feder <anders.feder...@gmail.com>wrote:
>
>> Thanks for your response, but could you please elaborate a bit? I don't
>> have the lingo that straight yet. What exactly should I do? Should I add
>> something in the AndroidManifest file? If so what, and where? Thanks again.
>>
>> Anders Feder
>>
>> 2009/10/5 <kapnk...@gmail.com>
>>
>> just add that extra bundle to intent & start new activity with this
>>> extra.in the activity just retrive the bundle you added to it.
>>>
>>>
>>> On Mon, Oct 5, 2009 at 5:12 AM, Anders Feder 
>>> <anders.feder...@gmail.com>wrote:
>>>
>>>>
>>>> Hi,
>>>>
>>>> I'm developing an application with android.telephony.gsm that is
>>>> supposed to process incoming SMS messages.
>>>>
>>>> I've figured out that I need to have a BroadcastReceiver for receiving
>>>> the incoming messages. But how am I supposed to pass the received
>>>> messages from the BroadcastReceiver and on to my Activity?
>>>>
>>>> Thanks in advance,
>>>>
>>>> Anders Feder
>>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to