Is it possible to use Intent to update a value in another activity?
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.
精彩评论