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

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.
Thank you for reading this article Python scripting in Android With URL https://x-tutorials.blogspot.com/2009/10/python-scripting-in-android.html. Also a time to read the other articles.
0 comments:
Write your comment for this article Python scripting in Android above!