Home » » Python scripting in Android

Python scripting in Android

Written By MR HARI on Sabtu, 10 Oktober 2009 | 13.18

Android Scripting Environment (ASE) allow Python script to be run in Android.

Before you can edit and run Python program, you have to Add Interpreter of Python.

Start Android Emulator and ASE installed in the previous article, android-scripting: Android Scripting Environment.

Press MENU key, and select Add Interpreter.

Select Add Interpreter>Python 2.6.2
Wait it to be downloaded and extracted.

Press MENU key again, and select Add Script.


Select Python 2.6.2.


Type the name in the upper box; eg. HelloAndroidPython.py.
Type your Python codes in the lower box. Every Python come with the codes:

import android

droid = android.Android()

It's the android module, which is needed in every Python script that interacts with the available Android APIs.

Add the code below:

droid.makeToast("Hello Android! in Python")



Press MENU and click Save & Run.


Lets see the result:


That's my first Python script in Android:)

------------------------------------------------------------------
For more details of the Python Android API, refer to:
PythonAndroidAPI - A description of the Android API available to Python scripts.
Share this article :

0 komentar:

Posting Komentar

 
Support : Your Link | Your Link | Your Link
Copyright © 2013. Android Center - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger