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?

2
  • want to pass which type of object ? integer, float, string ? Commented Aug 30, 2010 at 5:44
  • I have an object that is serializable Commented Aug 30, 2010 at 5:46

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

2 Comments

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.
See the following question: stackoverflow.com/questions/3597919/…
1

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);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.