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?
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.
Related
as i'm still learning, i'm not sure what tools, frameworks, even languages i'm gonna work with..
so i'm working on a simple project that got windows side and android side.. that obviously needs at least 2 languages to get it done, but it's impossible that i can learn those languages and know how to deal with their frameworks to get the job done
so is there a language i can develop the entire project(windows & android) with, and without need to any other language no matter what or how many tools or methods im gonna use to make it work?
-note: i know java is essential for the android side, so that's the point im talking about.... "entirely"
I would recommend you giving a loot at Flutter, it's not like native windows but it can produce applications for Android, iOS and web with a single codebase. It's really intuitive to use and the apps built with it work really well.
You can also take a look at React Native expect you need a Native app that you have to use Java as the core language if not give a trial to this
I notice you've tagged this with C#. To answer your question: that. You can write Android apps in it as well via a library called Xamarin that Microsoft bought out and has integrated into the platform.
I am thinking about picking up android development in my free time. I see that development is possible in Java and C++ but the latter is limited.
I am much more comfortable with C++.
So my question is what limitations exist with C++ on Android? Will I be able to develop full apps with it, or will I eventually have to learn Java?
Pick the right tool for the job. The right tool for android is java, and occasionally c++ if it's really needed. Android runs on several different CPUs, and you'd be required to deal with fun stuff like compiling for platforms that you can't really test on - at least if you want to make apps for anyone but yourself.
It's all dependent on what you want to do, but the general rule of thumb:
C++ is for speed (for example games).
Java is for UI and general Android programming.
You cannot code an entire Android application using only C++, the android SDK is written in Java and that is what you will have to use.
This said you can still use C++ for heavy stuff.
I have a Java application that runs on BlackBerry (JDE 4.5). I want to port this application to Android, and be able to maintain the 2 applications simultaneously. I may also want to port this application to other Java platforms (J2ME ?).
I understand that a good part of the code will have to be specific to each platform (UI and other stuff). But I also feel that a lot of the code could (should) be shared (domain related classes).
What is the best way to achieve this, and what are the pitfalls to avoid?
I have been able so far to create a JAR with all my shared classes, that I have been able to integrate into my BlackBerry application (using preverify and rapc). But:
The JAR is a J2SE library. How can I make sure that it will run (or even compile) on BlackBerry, Android or J2ME?
I am also using a JSON library targeting J2ME (https://github.com/upictec/org.json.me/). This library seems to make use of some kind of preprocessing directives (CLDC, see https://github.com/upictec/org.json.me/blob/master/src/main/java/org/json/me/JSONObject.java#L392). How can I use (or convert) this library using the right preprocessing definitions?
This is likely to be difficult:
As you have already identified, the UI code will have to be different for each platform.
There are major differences between Java SE / Android and Java ME-based platforms. For example, ME doesn't have the Collections framework, or the java.io or java.nio stacks.
It is hard to predict from the information you've provided, but there's a fair chance that you'll spend more time fighting the platform dependencies than you are saving by sharing the code-base.
These days, the biggest stumbling block to sharing code this way is that the BlackBerry VM and Android VM both support different versions of the Java language. BlackBerry uses a subset of Java 1.3, Android uses a subset of Java 1.5. (As an aside, neither platform implements a Java VM, both use their own VMs. Java is used as the programming language. Java bytecodes must be transformed to the appropriate native VM format before they can run on the platform.)
The biggest difference you will find as a library implementor is that the BlackBerry lacks the things that were introduced in 1.5, very important things like generics and enums. Even worse, the Collections classes are missing from the BlackBerry. It is unfortunate, but that is the way it has been for a long time now.
This means that to be truly portable you have to write to the lowest-common denominator, which means using (very) old-style classes like Hashtable and Vector, not having generics, rolling your own enums (as in the 1st edition of Effective Java) and so on.
Or you build two libraries, a modern version for Android and a stripped-down version (with just the bare stuff you need) for the BlackBerry.
Hard to say what`s right for you.
Rather than prepackage your shared library, I would consider sharing the library project and having it as a dependency in your mobile applications' build process. That would allow you to share the code base, but have it built by the appropriate builders for your target devices. With a bit of IDE magic and some attention to detail, you should be able to pick up errors before anything is shipped out.
Alternatively, set up your library project to use two separate builders to pick up errors. That would allow cleaner distribution, but you may run into problems trying to convince your IDE to treat the project as being device specific in order to identify problem areas.
It would be likely that you would end up supporting the lowest common denominator device (cough Blackberry), and forgoing the additional facilities of the more extensive Java implementation on Android.
Unfortunately the answer will be one of experimentation. Try it and see what happens.
The article Porting Android code to BlackBerry has some good detail on how to work with code shared between the two platforms.
it will be very difficult to create shared library for blackberry and android.
if you want simple method, create your application as web app.
using
phonegap with jQtouch
I'm working in a Java-oriented shop and we're starting to adapt our products to mobile devices now (mainly focusing on smart phones). A separate native app is already in the works for the iPhone, but we would like to make a generic Java/J2ME version for any other devices.
My question is, how feasible is this? And where is the divergence point generally? ie We don't mind if each device has some variation in it's specific Java toolkit and they require separate builds, and thus all we can have is just have some basic framework stuff in common underneath. We're just trying to architect this in such a way that as much of the basic framework can be re-used as possible.
The main target platforms we're looking at are Android, Symbian, and generic Java-enabled mobile devices.
Anyone have any advice, pointers, or good links they can point me at?
The biggest divergence point will be the UI. You will need an entirely seperate UI for an Android App vs. a J2ME app.
If your app does not depend on any hardware components, client side databases, etc. you should be able to reuse any other data model/ backend processing classes.
In my work we have a common Java code base that is used in J2ME, Android and BlackBerry and we have had to address some significant issues:
As Mayra says UI will be huge difference, so you are better off having different UI layers for J2ME and Android.
To make it compile for J2ME you will have to make your common code Java 1.3 compatible. This requires careful design, and nightly builds that compile for each of these platforms.
Because of the above reason we found it a good idea to write your application/game module in Java 1.3 compatible mode.
It also helps if you have a good release management system, because you now have common code for multiple platforms, so, versions, release planning, branching code and its impact on release, all these can become a major headache without careful handling.
If you are planning cross-platform compatibility in modules like C++ and its compatible Java application engine then do yourself a favor and write modules in human understandable format, for example write SaveData class, instead of SaveToRMS in J2ME and SaveFile in Symbian. That way you are encapsulating platform dependent implementation while making it easier for the developer to know whats happening in the class.
Lastly, know that it will take about 6-9 months for a framework like this to mature, so be patient, and good luck.
Well, if you build a web application, all you can do is to do some modifications to adapt it to mobile browsers (if you design it well, there will be only css modifications).
Since you're talking about a shop, it makes totally sense to be online.
I would follow this path.
I just ordered an Android smartphone and want to start playing around with creating my own applications. Now the question is which language to use, the native Java or Python using SL4A (former ASE).
I tend to Python, as I know it much better than Java, but I'm wondering what I would be missing using a "second class" language on Android. On the SL4A website it is also stated to be alpha quality software, which is not exactly encouraging.
I'm also not quite sure what the limitations of the scripting environment are and if they would be problematic.
At the moment you cannot create a releasable program with Python (or any other scripting language) using SL4A. I have heard rumours that this is something Google is working on, but even if they do enable it Python apps are likely to be slow and power-hungry compared to Java. Also the scripting API only gives you access to a limited subset of the native Java API. I would not consider using SL4A for serious development work at the moment, only for one-off scripts and prototyping.
Take a look at Scala. It is a statically typed language on the JVM, but uses type inference to remove most of the noise that you get in Java. It also fully supports functional programming, and has a lot of pythonish features. Because it is statically typed it is as efficient as straight Java with none of the disadvantages. IMHO it is the language that Java should have been in the first place.
A lot of people are blogging about using Scala on Android, so Google around for more information.
More likely will depend what type of applications you will develop.
I would start with Java to become familiar with Android SDK. Anyway first you need to look into some examples, tutorials. Most of them are done in Java, and only a few, probably on the dev site of SL4A for that.
Also there is native development Android NDK, that can be programmed with C++.
But anyway Java rules for general applications.
Adding an update to Dave Kirby's answer:
Issue 55, Distribute scripts as APKs, in the issue tracker at SL4A deals specifically with that.
There is a solution being worked out (may be complete by now) described at SharingScripts. The only issue seems to be that you need to have a interpreter APK already installed.
you may want to check out Ruboto it is a framework for developing Android apps based on JRuby which means your JRuby code can call Android APIs and can also be called back from the Android Java side.
Here is an introduction article .
Consider ising Kivy, if you want to write Android apps with Python. The process of packing script to .apk file is described here.
The problem is, resulting .apk will be big (~7Mb for 300Kb data). It is obvious, because you need to pack there Python runtime and all libraries.
Another solution I have heard of, is Pygame for Android, but it works on lower lewel, so you need to draw graphics manually.
Unfortunately, I have not tried any of this ways yet, but it looks, that I'm going to start using kivy soon.