Repository: beeware/toga

Issue:
Error on Android when converting selection value to String
Sample app:
```
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW

class AFV(toga.App):

    def startup(self):
        self.main_window = toga.MainWindow(title=self.formal_name)

        box_test = toga.Box(style=Pack(direction=COLUMN, padding=5))
        self.label_1 = toga.Label('TESTE 1')
        self.comboBox_1 = toga.Selection(items=["ITEM 1", "ITEM 2", "ITEM 3"])
        self.lineEdit_1 = toga.TextInput()
        self.pushButton_1 = toga.Button('TESTE')

        box_test.add(self.label_1, self.comboBox_1, self.lineEdit_1, self.pushButton_1)

        self.pushButton_1.on_press = self.print_combo

        self.main_window.content = box_test
        self.main_window.show()

    def print_combo(self, widget):
        name_combo = self.comboBox_1.value
        print(name_combo)



def main():
    return AFV()
```

When the button is pressed, the error:

        com.chaquo.python.PyException: AttributeError: 'str' object has no attribute 'toString'

is raised.

Using Briefcase 0.3.10; worked previously on Briefcase 0.3.9.
Error on Android when converting selection value to String
Sample app:
```
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW

class AFV(toga.App):

    def startup(self):
        self.main_window = toga.MainWindow(title=self.formal_name)

        box_test = toga.Box(style=Pack(direction=COLUMN, padding=5))
        self.label_1 = toga.Label('TESTE 1')
        self.comboBox_1 = toga.Selection(items=["ITEM 1", "ITEM 2", "ITEM 3"])
        self.lineEdit_1 = toga.TextInput()
        self.pushButton_1 = toga.Button('TESTE')

        box_test.add(self.label_1, self.comboBox_1, self.lineEdit_1, self.pushButton_1)

        self.pushButton_1.on_press = self.print_combo

        self.main_window.content = box_test
        self.main_window.show()

    def print_combo(self, widget):
        name_combo = self.comboBox_1.value
        print(name_combo)



def main():
    return AFV()
```

When the button is pressed, the error:

        com.chaquo.python.PyException: AttributeError: 'str' object has no attribute 'toString'

is raised.

Using Briefcase 0.3.10; worked previously on Briefcase 0.3.9.


Discussion:
Thanks for the report. I suspect this is an issue with the Rubicon compatibility layer in Chaquopy.

As an aside - when you created this bug report, you would have been  presented with a template that had prompts for details like "Describe the bug",  "To Reproduce", and "Expected behavior". These are *not optional* - they are the bare minimum of what we need to diagnose problems. I've updated the report to include the extra details that I know based on the conversations that have been ongoing in Discord.
Also, when posting an exception, please include the full stack trace, not just the first line.
Here it is with Toga 0.3.0.dev38:
```
10-08 12:41:52.997  8234  8234 E AndroidRuntime: com.chaquo.python.PyException: AttributeError: 'str' object has no attribute 'toString'
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.toga_android.widgets.selection.get_selected_item(selection.py:48)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.toga.widgets.selection.value(selection.py:58)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.helloworld.app.print_combo(app.py:25)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.toga.handlers._handler(handlers.py:66)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.toga_android.widgets.button.onClick(button.py:19)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.chaquopy_java.call(chaquopy_java.pyx:379)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrowsNative(chaquopy_java.pyx:351)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at com.chaquo.python.PyObject.callAttrThrowsNative(Native Method)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at com.chaquo.python.PyObject.callAttrThrows(PyObject.java:232)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at com.chaquo.python.PyInvocationHandler.invoke(PyInvocationHandler.java:31)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at $Proxy7.onClick(Unknown Source)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at android.view.View.performClick(View.java:7506)
```
Thanks for the report. I suspect this is an issue with the Rubicon compatibility layer in Chaquopy.

As an aside - when you created this bug report, you would have been  presented with a template that had prompts for details like "Describe the bug",  "To Reproduce", and "Expected behavior". These are *not optional* - they are the bare minimum of what we need to diagnose problems. I've updated the report to include the extra details that I know based on the conversations that have been ongoing in Discord.
Also, when posting an exception, please include the full stack trace, not just the first line.
Here it is with Toga 0.3.0.dev38:
```
10-08 12:41:52.997  8234  8234 E AndroidRuntime: com.chaquo.python.PyException: AttributeError: 'str' object has no attribute 'toString'
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.toga_android.widgets.selection.get_selected_item(selection.py:48)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.toga.widgets.selection.value(selection.py:58)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.helloworld.app.print_combo(app.py:25)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.toga.handlers._handler(handlers.py:66)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.toga_android.widgets.button.onClick(button.py:19)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.chaquopy_java.call(chaquopy_java.pyx:379)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at <python>.chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrowsNative(chaquopy_java.pyx:351)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at com.chaquo.python.PyObject.callAttrThrowsNative(Native Method)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at com.chaquo.python.PyObject.callAttrThrows(PyObject.java:232)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at com.chaquo.python.PyInvocationHandler.invoke(PyInvocationHandler.java:31)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at $Proxy7.onClick(Unknown Source)
10-08 12:41:52.997  8234  8234 E AndroidRuntime:        at android.view.View.performClick(View.java:7506)
```

Resolving patch:
diff --git a/src/android/toga_android/widgets/selection.py b/src/android/toga_android/widgets/selection.py
--- a/src/android/toga_android/widgets/selection.py
+++ b/src/android/toga_android/widgets/selection.py
@@ -22,9 +22,6 @@ def create(self):
         self.native.setOnItemSelectedListener(TogaOnItemSelectedListener(
             impl=self
         ))
-        # On Android, the list of options is provided to the `Spinner` wrapped in
-        # an `ArrayAdapter`. We store `self.adapter` to avoid having to typecast it
-        # in `add_item()`.
         self.adapter = ArrayAdapter(
             self._native_activity,
             R__layout.simple_spinner_item
@@ -45,7 +42,7 @@ def select_item(self, item):
     def get_selected_item(self):
         selected = self.native.getSelectedItem()
         if selected:
-            return selected.toString()
+            return str(selected)
         else:
             return None
 


Test patch: