Hi
I have a newbie question which is puzzling me regarding using Intents
to start a new Activity but passing some data with the Intent for the
new Activity to use.
My app has (say) MainActivity from which I want to launch a second
activity, SecondActivity, within the same app, whilst I pass an
integer parameter to SecondActivity.
In MainActivity I want to use an explicit component with my Intent
like this,
MainActivity ---------------------------------------- FRAGMENT
BEGIN--------------------------------------------------------
int rowId ;
rowId = <some-value> ; // want to start SecondActivity and pass this
value to it.
Intent i = new Intent( this, SecondActivity.class );
// Now add rowId as Extra Data
i.putExtra("com.foo.bar.android.app.rowid", rowId);
// start the Activity
startActivity(i);
MainActivity ---------------------------------------- FRAGMENT
END--------------------------------------------------------
Now my problem is : how do I receive the Intent when SecondActivity
gets started and recover
the value of the integer parameter ? Which member function of
class SecondActivity extends Activity {
<SNIP...>
}
will receive the Intent ? SecondActivity::onCreate() ?
Or do I need to register a BroadcastReceiver with SecondActivity whose
onReceive() method would
pick up the Intent ?
What is the recommended way of doing this within the Android
Framework ?
Thanks for any help
Graeme
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---