开发者

Is it possible to use Intent to update a value in another activity?

开发者 https://www.devze.com 2023-01-13 21:46 出处:网络
I want to pass a value from one Activity to ano开发者_StackOverflow中文版ther to update an integer.So basically I want Activity2 to send Activity1 a value it has garnered from user input.Seems like it

I want to pass a value from one Activity to ano开发者_StackOverflow中文版ther to update an integer. So basically I want Activity2 to send Activity1 a value it has garnered from user input. Seems like it should be simple just not sure how. Is it possible to run a function from another Activity and give it this value as an argument?


Have Activity1 use startActivityForResult() to start up Activity2. Have Activity2 call setResult() before finish()-ing. Have Activity1 override onActivityResult() to get the result.

0

精彩评论

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