Difference between Kivy and Java for android apps-ThrowExceptions

Exception or error:

I’m a python developer with little experience creating android apps in java and want to create an app that will access my university web portal, retrieve some data and show on a view.

So, after researching Kivy, I have a few questions:

1) Which one is easier and faster to develop android apps?

2) Does Kivy have any android feature limitations?

3) And finally, would an android app developed using kivy run as fast as one developed using java?

How to solve:

This is a rather subjective question.

1) Which one its easier and faster to develop android apps?

I think there’s a strong argument for kivy, but this doesn’t have an objective answer.

2) Does Kivy has limitations to access certain parts of android (like not fully integrated with its api)?

The kivy project includes pyjnius, a tool for accessing java classes through python, and in principle I think this should give arbitrary (edit: on reflection, not arbitrary, but probably not limited in immediately important ways) access to the java apis.

In practice, prebuilt python wrappers are a work in progress, though rapidly improving. The android python library already gives easy access to many things (including but not limited to intents, vibration, accelerometer etc.). Even where there isn’t already a python wrapper, it can be very easy to do the necessary work.

Edit: There has recently been great work on Kivy’s plyer project, intended to provide a transparent api to platform specific tools so that you can call it once and get the same behaviour on different systems without knowing about the details. It includes useful support for parts of the android api.

3) And finally, an android app developed using kivy would run as fast as one developed using java?

Ultimately the answer is probably no, but the difference is highly unlikely to be important unless you’re doing something strongly cpu limited. The task you suggest would not be limited in that way.

###

To complete inclement’s answer, pyjnius indeed allows to access a lot of the android api. But it’s not perfect, calling existing classes is not always enough, and an android programmer often need to create code that will be called by android to manage events, there are two ways to do that, both used by the android api.

  • The first one is interfaces: you need to create a class that implement an existing java interface, pyjnius can do that, you create a python class and declare which java interface it implements, and have a decorator to declare the methods you have to declare.
  • The second is subclassing, you need to subclass an existing java class and override some methods, and we don’t have a way to do that with pyjnius yet, so for these ones, you’d have to create a java class and use it in your program (fortunately you can mix that with kivy/pyjnius, it’s just can’t be 100% python in that scenario).

So it can be worth a look to the api beforehand, to see if the parts of the android api you have to access requires that.

Leave a Reply

Your email address will not be published. Required fields are marked *