How to set result for activity in Android?
Question
I have a ListActivity
that is started with startActivityForResult
by a PreferenceActivity
.
On ListItemClick
, I want to return with a result to my PreferenceActivity
.
How do I do this? When will onActivityResult
be called?
Solution
Call this on List Item Click Event.
Intent data = new Intent();
data.putExtra("SOMETHING", "EXTRAS");
setResult(RESULT_OK, data);
finish();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow