Developing Android Applications Using Python

11

Is it possible to create Android applications with the Python language? If so, how does it work?

    
asked by anonymous 14.02.2014 / 20:46

1 answer

10

Yes, it is possible.

Once I saw a discussion of this in the fedora infrastructure list, they indicated this sdk: link

It turns a program into Phyton into an apk. I used very little.

Follows a famous HelloWorld:

import kivy
kivy.require('1.0.9')
from kivy.lang import Builder
from kivy.uix.gridlayout import GridLayout
from kivy.properties import NumericProperty
from kivy.app import App

Builder.load_string('''
<HelloWorldScreen>:
    cols: 1
    Label:
        text: 'Welcome to the Hello world'
    Button:
        text: 'Click me! %d' % root.counter
        on_release: root.my_callback()
''')

class HelloWorldScreen(GridLayout):
    counter = NumericProperty(0)
    def my_callback(self):
        print 'The button have been pushed'
        self.counter += 1

class HelloWorldApp(App):
    def build(self):
        return HelloWorldScreen()

if __name__ == '__main__':
    HelloWorldApp().run()

Just use the command below to generate the apk.

./distribute.sh -m 

Complete documentation (English): link

    
14.02.2014 / 20:56