Michael S.
Michael S.

Reputation: 201

How to return the selected item from a ListActivity to another Activity?

I've been using Android for only a little while. In my application, I have two Activities. The first launches the second, which is a ListView.

From this second activity, the one with the ListView, how do I return the selected value back to the original activity. I want to change certain values from the original activity based on the selection from the second activity.

Do you follow what I'm getting at here?

I'm using an intent to launch the second activity.

Someone please let me know a simple solution.

Thanks in advance!

Michael

Upvotes: 1

Views: 738

Answers (1)

Bobbake4
Bobbake4

Reputation: 24857

You can do this by using startActivityForResult and using setResult to send the data you want back to the calling activity. This is a good section of the docs to guide you on how to do this.

Upvotes: 2

Related Questions