Passing a string from one activity to previous activity
I am trying to pass a string from current activity to previous activity. I tried with intent, but it got failed. how can i pass it? Can anyone help me to find a solution for this?....i struck with this from 4 days... please he开发者_如何学Clp me as soon as possible.
Thanks in advance..
before your new activity (B) is finishing, use setResult()
Intent data = new Intent();
data.putExtra("RESULT", "my string to pass to previous activity");
setResult(RESULT_OK, data);
and in the previous activity (A) you must use startActivityForResult()
for starting the activity B
then in activity A override onActivityResult()
to retrieve the result.
精彩评论