开发者

Writing python (or any other SL4A) in android [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 8 years ago.

Improve this question

Can someone point me to a tutorial on using the android scripting enviornment? I've seen plenty of tutorials on how to write python code using the android API especially from http://code.google.com/p/android-scripting/wiki/Tutorials.

But none of what I've seen gives a good example of开发者_如何学C how this all works inside android or how to call your python stuff from an android application. I'm looking for a tutorial that basically can bring it all together just so I can see an example of an actual android app running python scripts.


Note: All this was tested on my Samsung Galaxy S running Android 2.2. YMMV.

I never thought of running Python on android till I saw this. Thanks :)
I installed the SL4A app and tried out a simple Shell script. I am installing the Python interpreter and will be trying out a hello world soon.

The step were straight forward:
1. Download the app (it.s not on the market so get it from http://code.google.com/p/android-scripting/)
2. Create a shell script by clicking the Add button and choosing Shell in the options that pop-up
3. Write your code.
4. Select "Save and Run" (or "Save and Exit" and click on the script name in the main window)
5. At this point your script's output should show up in the terminal window.

Now I am trying to install the Python interpreter. Will keep the thread updated but I guess this will be same set of steps. I am having a lot of issues downloading the files - the download is slow and keeps closing.

I don't know if you can call these scripts from an Android appln. The intention of the project seems to be the other way around. But what do I know!

Edit: Continuing with my experience with Python.
1. Open SL4A and go to View->Interpreters menu. If Python isn't listed then select Add from the menu.
2. This will download an apk which you install (make sure install non-market applications is available)
3. Open the Python for Android app. It has a single button "Install"
4. Click on the Install and wait... and wait... Don't use the phone till this the install is there seems to be bug in this app so if you use any other app on the phone or tab away from this one the download gets cancelled!!!
5. After a successful install return to SL4A you should now see Python in the Interpreters and a lot of sample Python scripts.
6. The samples seem to cover quite a bit of the APIs. I was quite impressed by what I saw.

Edit: Since the original post I have also tested on a Galaxy S2 running Android 4.0. with similarly impressive results.


After installing Android Scripting (SL4A) .apk have you installed Python for Android?

  1. This would surely work now whenever you start SL4A you would tap for more options
  2. you will get to see Add button just click on that create your scripts.
  3. while running it would ask for running environment choose terminal for that.
  4. The Terminal runs.
  5. First for testing Python is running on you Android or not Test the Sample programs at the SL4A.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜