Saturday, April 23, 2011

Scripting on android

With growing popularity if android amongst the developers, google launched the project Scripting Layer for Android(SL4A) which enables the developers to write scripts in multiple languages such as PHP,Perl,python,Lua,JRuby etc. All you need to do is to install SL4A from the android market and add the interpreters. The API for all the languages is almost similar and easy to understand. A quick helloworld example in all the supported languages can be seen  here . Also there is a complete list of tutorials which will help explain the usage. The neat API reference is also present to make the work easy for the developers.For each installed interpreter, there will also be a set of examples to keep you motivated. for example, a simple python program to open the camera, click a picture and save to the sdcard would cost you just 3 lines of code as:
import android
droid = android.Android()
droid.cameraCapturePicture('/sdcard/python_picture.jpg')


I would try to post some tutorials on SL4A scripting soon.For now check out the SL4A screencasts for a kickstart!