Are there basic GUI functions in SL4A? I'd like to run a python program on Android and would need a listbox and simple dialogs (display info and get input).
There seem to be simple dialogs, but I haven't found a listbox. If there isn't a listbox, I should be able to create one if there's the ability to write text and highlight rectangles to specified parts of the screen and react to the user touching the screen or typing (including knowing where the user touched or where the cursor is).
Essentially there are three things you can do:
If you just want simple Android lists and inputs, such as getting a user's input (e.g., a username and password) or showing a list of option to choose from, then there are some tutorials here: http://code.google.com/p/android-scripting/wiki/UiExamples
If you want to show information (i.e., not have the user select it), you could try showing HTML in a WebView and respond via events: http://code.google.com/p/android-scripting/wiki/UsingWebView
Doing this, you get limited functionality via events by using droid.eventPost(eventName,eventData);
in JavaScript and droid.eventWaitFor(eventName).result
in Python. You can then do whatever you want with the received data.
If you're feeling brave, the latest unofficial release contains support for full Android layouts (ones made in XML, like those found in a native Android app). You can find a guide for that here: http://code.google.com/p/android-scripting/wiki/FullScreenUI
If you want a python GUI solution on Android/iOS/Linux/Windows/Mac you can use kivy... its nice! kivy.org
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With