Turns out I just barely had to do something similar...
In order to get the data from the intent you created, you need to do the
following in the activity that is started:
Bundle extras = getIntent().getExtras();
if (extras != null)
{
...do stuff...
String value = extra.getString("myKey");
}
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 10:46 PM, <[email protected]> wrote:
> if you do simply as you written & if what ever clear from your post to me
> here the activity will start every time you receive the message?is it ok
> with you?but if you want to start some activity from user will will acess
> the receivid data then just save that data some where n the acess it from
> user activity.
>
> On Mon, Oct 5, 2009 at 10:28 PM, Anders Feder
> <[email protected]>wrote:
>
>> 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 <[email protected]>
>>
>> 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
>>> <[email protected]>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 <[email protected]>
>>>>
>>>> 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 <
>>>>> [email protected]> 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 [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
-~----------~----~----~----~------~----~------~--~---