views:

114

answers:

2

I want to pass an object from Activity B to Activity A.

Scenario: - Activity A calls Activity B - User selects item in Activity B - Activity B passes an object to Activity A

How do I accomplish this? And in which method do I read in the passed object in Activity A?

+4  A: 

you can start your intent using startActivityForResult on Activity A ... And when finishing Activity B declare a bundle and put your serializable object to your bundle and add it to your intent. On Activity A's onActivityResult method you can get this intent back and retrieve your bundle...

Refer to this sample below.

http://micropilot.tistory.com/1577

Rahul
I have an interesting problem. I have an Activity that calls a Search Manager which directs me to Activity B. I want to pass some data from B to A at this point. onActivityResult never gets called in Activity A.
Sheehan Alam
See the following question: http://stackoverflow.com/questions/3597919/how-to-handle-callback-from-search-manager
Sheehan Alam
+1  A: 

Intents are used to send data between 2 activities....If its serializable data than send it using: Eg: Intent myIntent = new Intent(home.this,dvd.class); myIntent.putExtra(name, value);

Rohan K