Python for Android [LinuxJournal]
Think Java’s the only game in town when it comes to programming Android apps? Think again.
Mobile app development for smartphones is hot. This is no more prevalent than in the Android space where the activity level oftentimes is frenzied. However, when it comes to building a “real” Android app, it seems there’s only one programming choice: Java (although it is possible with a lot more work to use C/C++ with Android’s Native Development Kit). That said, Google wisely chose the popular Java programming technology upon which to base its Android SDK, which runs a customized VM.
By and large, this has been a smart strategy, as (unlike another popular smartphone) there’s no need to own specific hardware and software to get started with app development on Android. All you need is a PC (or laptop) running Linux, Windows or Mac OS X, together with a copy of Java and the free Android SDK. Google provides emulator downloads for all the Android platform releases, and there’s even a free plugin for Eclipse to start you off and point you in the right direction.
That’s great—assuming, of course, you’re a fan of Java. If, like me, you’d rather eat glass than sit down to write some Java code in Eclipse, it would appear that you are out of luck when it comes to implementing your next project on Android. But, this is not the case. There’s a rather wonderful project called the Scripting Layer for Android (SL4A) that is bringing scripting languages to the Android platform and providing a working alternative to Java development.
In this article, I walk through the steps involved in preparing your computer for Android development with SL4A, then show how to write, test and run a simple script written in Python on your Android device.…