Skip to main content

Is there any way to run Python on Android?


I like the Android platform. Actually, with some friends, we even participate to the ADC with the Spoxt project.



But Java is not my favourite language at all. We are working on a S60 version and this platform has a nice Python API. Of course there is nothing official about Python on Android, but since Jython exists, does anybody know a way to let the snake and the robot work together ?


Source: Tips4allCCNA FINAL EXAM

Comments

  1. How about Kivy?
    http://kivy.org/#home

    "Open source library for rapid development of applications
    that make use of innovative user interfaces, such as multi-touch apps."

    "Kivy is running on Linux, Windows, MacOSX and Android. You can run the same [python] code on all supported platforms."

    Kivy Showcase app
    https://market.android.com/details?id=org.kivy.showcase&hl=en

    ReplyDelete
  2. There is also the new ASE project, it looks awesome, and has some integration with native Android components. Android Scripting Environment

    ReplyDelete
  3. YES!

    An example via Matt Cutts -- "here’s a barcode scanner written in six lines of Python code:

    import android
    droid = android.Android()
    code = droid.scanBarcode()
    isbn = int(code['result']['SCAN_RESULT'])
    url = "http://books.google.com?q=%d" % isbn
    droid.startActivity('android.intent.action.VIEW', url)

    ReplyDelete
  4. "The Pygame Subset for Android is a port of a subset of Pygame functionality to the Android platform. The goal of the project is to allow the creation of Android-specific games, and to ease the porting of games from PC-like platforms to Android."

    The examples include a complete game packaged in an APK, which is pretty interesting.

    ReplyDelete
  5. I just posted some directions for cross compiling Python 2.4.5 for Android. It takes some patching, and not all modules are supported, but the basics are there.

    ReplyDelete
  6. There's also SL4A written by a Google employee.

    ReplyDelete
  7. As a python lover and Android programmer, I am sad to say this is not really a good way to go. There's two problems.

    One problem is that there is a lot more than just a programming language to the Android development tools. A lot of the Android graphics involve XML files to configure the display, similar to HTML. The built-in java objects are really integrated with this XML layout, and it's a lot easier than writing your own code to go from logic to bitmap.

    The other problem is that the G1 (and probably other android devices for the near future) are really not that fast. 200 Mhz processors, and RAM is very limited. Even in Java you have to do a decent amount of rewriting-to-avoid-more-object-creation if you want to make your app perfectly smooth. Python is going to be too slow for a while still on mobile devices.

    ReplyDelete
  8. Check out this blog here that explains how to install and run python and a simple webserver written in python on Android.

    http://www.saffirecorp.com/?p=113

    ReplyDelete
  9. Not at the moment and you would be lucky to get Jython to work soon. If you're planning to start your development now you would be better of with just sticking to Java for now on.

    ReplyDelete
  10. Given the Oracle lawsuit, lets just lobby Google to replace Dalvik with Pylvik and be rid of Larry and the J2me, which I've seen called an overly verbose mess by people who gave impressive code examples...

    I guess there's ASEand this 10-step instruction and this cool example
    and the SL4A Wiki

    ReplyDelete
  11. SL4A does what you want and is actively developed. You can install it from the Market and don't need root. It supports a range of languages, Python support is currently for version 2.6, but the owner, Robbie, is personally working on Python3. Check it out.

    http://code.google.com/p/android-scripting/

    Update: Python3 is out, but it's not running very well.

    ReplyDelete
  12. There's also python-on-a-chip possibly running mosync:

    http://groups.google.com/group/python-on-a-chip/browse_thread/thread/df1c837bae2200f2/02992219b9c0003e?lnk=gst&q=mosync#02992219b9c0003e

    ReplyDelete
  13. Using SL4A (which has already been mentioned by itself in other answers) you can run a full-blown web2py instance (other python web frameworks are likely candidates as well). SL4A doesn't allow you to do native UI components (buttons, scroll bars, and the like), but it does support WebViews. A WebView is basically nothing more than a striped down web browser pointed at a fixed address. I believe the native Gmail app uses a WebView instead of going the regular widget route.

    This route would have some interesting features:


    In the case of most python web frameworks, you could actually develop and test without using an android device or android emulator.
    Whatever Python code you end up writing for the phone could also be put on a public webserver with very little (if any) modification.
    You could take advantage of all of the crazy web stuff out there: query, HTML5, CSS3, etc.

    ReplyDelete
  14. From the Python for android site:


    Python for android is a project to create your own Python distribution including the modules you want, and create an apk including python, libs, and your application.

    ReplyDelete

Post a Comment

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex