Passing parameters to new Activity

by » Tue, 03 Mar 2009 02:52:03 GMT

Sponsored Links
 Hi all,

I'm programming an Activity that launches a second one through
startActivity just like in the Forwarding example. The main difference
is that I'd like to pass some data to the second Activity when
starting it, for example an item selected in a list owned by the first
Activity. I can't find how to do that... Am I missing something? I
guess I do.

Thank you for helping me.


Passing parameters to new Activity

by Marco Nelissen » Tue, 03 Mar 2009 03:08:45 GMT

 You can add 'extras' to the Intent that you use to start the 2nd Activity.

On Mon, Mar 2, 2009 at 8:34 AM,


Sponsored Links

Passing parameters to new Activity

by » Fri, 06 Mar 2009 21:46:36 GMT

 Works fine! Thanks Marco.

Other Threads

1. Starting Google Maps at pre-specified location

Well, clearify, what I've said:

I'm using next code in order to open Google Maps at "London" (for

public void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.query); //my first layout with button

        Button searchbutton = (Button) findViewById(; //
simple button, when click by user comes - Maps are opened
        searchbutton.setOnClickListener(new OnClickListener(){

                public void onClick(View view) {
();                                                         //method
that opens Maps (see below)
private void openmap(){

//Now starting Intent with parameters, open a MyMap.class, where magic
happens - map appears, but on standard North American view...

        Intent i = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse
("geo:0,0?=London"), this, MyMap.class);

        startActivityForResult(i, ACTIVITY_CREATE);


What it could be? Any ideas?

2. Contact List With Header


I want to create a Contact List with a navigation header. I'll
explain, my application contains a navigation menu bar with 3 options,
one of those is Contacts. I want the user to be able to click on
Contacts, going to contacts section preserving the same navigation
menu bar.

So far I can not do this because the way SimpleCursorAdapter and
setAdapter works. When I try I get my navigation menu bar repeated for
each contact.

I'm using the example from the following URL:

Thanks in advance!


3. SMS inbox

4. XML and Programmatic Layout together

5. Accelerometer on Motorola Droid

6. Best Server for Android MultiPlayer Games?

7. SDK and NDK. Additional possibilities