Being able to write Android apps in Python sounded very appealing to me so I decided to try out Kivy, a Python library that lets you do just that.
Kivy actually allows you to run your Python app not just on Android, but on other platforms as well such as IOS, Linux, Windows, and Mac OSX. So it’s also a good option for writing desktop applications. The project seems to be very active and I was able to get responses quickly from the community.
To try it out, I decided to create a very simple application that displays random inspirational quotations (screenshot shown above). The app basically just has 2 widgets: a label to display the quote and a button to display a new one. The quotes are stored in an SQLite database.
The entire application is less than 100 lines of Python code. There are 2 main files: main.py which contains the Python logic, and randomquotes.kv which uses the Kivy language for creating the user interface. You can view the project code on GitHub here: https://github.com/jcalazan/random-quotes
I tried running it on my Dell Streak 5 Android phone and it’s unfortunately not supported as their sample apps didn’t run on my phone either. I then tried creating a .apk file to install it on an Android emulator and that turned out to be quite a disappointment also as Kivy apparently only runs on an Android emulator if the Open GLES option is enabled, which doesn’t work on my computer (Android emulator support was added in version 1.7.0 of Kivy). I’m actually very tempted to buy a new Android device right now just so I can test my apps on it.
Anyway, the project does look quite promising, with more features being added regularly and tools being created to make development quicker and easier. Definitely worth checking out.