Page 314 -
P. 314

positive or negative


           Select from a list on Android


           When your user taps on a button, the “result” of the call to
           dialogGetResponse() is set to positive if the first button is tapped
           or negative if the second button is tapped. In your code, you can check
           the value of resp, which is a dictionary, and the which key is set to either
           positive or negative.
          A subsequent call to dialogGetSelectedItems() returns the index
           value of the selected list item.












          Index item 0

           Index item 1


           Index item 2


           Index item 3


           Index item 4










               The “positive” button            The “negative” button



           So…if the positive button is tapped, you can index into the list of athlete names
           to see which athlete was selected from the displayed list. The selected name can then
           be sent to the web server to request the rest of the athlete’s data using the send_
           to_server() function.


          You can use this behavior in the next version of your code.

           278    Chapter 8
   309   310   311   312   313   314   315   316   317   318   319