I have two activities or "screens".
The second activity has an AlertDialogBox with radiobuttons for selecting a single option.
I want that after an option has been selected from the second activity's DialogBox, it should be displayed on the first activity screen in a text-view.
That is, suppose the user chooses "Green" from the dialogbox in the second activity, then "Green" should be displayed on the first activity screen.
Whats the way to pass a radiobutton开发者_运维百科value to the textview?
I will refer to your first activity (with the TextView
) as A and the second (with the radio buttons) as B.
Step #1: Have A start B via startActivityForResult()
Step #2: When the user clicks on a radio button, B calls setResult()
to supply the selection to A, then calls finish()
to return control to A
Step #3: A needs to override onActivityResult()
to get the results supplied by B
精彩评论