[android-beginners] Re: Passing messages from BroadcastReceiver to Activity

2009-10-07 Thread Sparky
Thanks Justin! I have spent like an hour looking for this simple but trivial information. Every source is talking about how to invoke intents and put extra info in it, but no one says how to actually use it in the invoked application. :-/ On Oct 6, 8:31 am, Justin Anderson

[android-beginners] Re: Passing messages from BroadcastReceiver to Activity

2009-10-07 Thread kapnkore
* public* *class* SmsReceiver *extends* BroadcastReceiver { //.. @Override *public* *void* onReceive(//...,...) { // Intent i = *new* Intent(contx, NoteEdit.*class*); i.putExtra(NotesDbAdapter.*KEY_ROWID*,

[android-beginners] Re: Passing messages from BroadcastReceiver to Activity

2009-10-06 Thread Justin Anderson
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); }

[android-beginners] Re: Passing messages from BroadcastReceiver to Activity

2009-10-05 Thread kapnkore
just add that extra bundle to intent start new activity with this extra.inthe activity just retrive the bundle you added to it. On Mon, Oct 5, 2009 at 5:12 AM, Anders Feder anders.feder...@gmail.comwrote: Hi, I'm developing an application with android.telephony.gsm that is supposed to

[android-beginners] Re: Passing messages from BroadcastReceiver to Activity

2009-10-05 Thread Anders Feder
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

[android-beginners] Re: Passing messages from BroadcastReceiver to Activity

2009-10-05 Thread Justin Anderson
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

[android-beginners] Re: Passing messages from BroadcastReceiver to Activity

2009-10-05 Thread Anders Feder
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(),

[android-beginners] Re: Passing messages from BroadcastReceiver to Activity

2009-10-05 Thread Justin Anderson
I believe that would be correct. As far as I can tell, the only way to determine the difference is by checking the following: - Bundle is null - Bundle doesn't have the key you specified. Again, I have not had the need to do this yet so I am only speculating. But this is what I understand from

[android-beginners] Re: Passing messages from BroadcastReceiver to Activity

2009-10-05 Thread kapnkore
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