开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜