Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Why do we use java for creating Android application?

Android is not only OS its a stack mechine, We use java as a programming language for creating android application..

user-image
Question added by SUHAD PV , Developer , Nexegen Software Solution
Date Posted: 2013/05/21

Why Java?

  • Android runs on many different hardware platforms. You would need to compile and optimize your native code for each of these different platforms to see any real benefits.

  • There are a large number of developers already proficient in Java.

  • Java has huge open source support, with many libraries and tools available to make developers life easier.

  • Java protects you from many of the problems inherent in native code, like memory leaks, bad pointer usage, etc.

  • Java allows them to create sandbox applications, and create a better security model so that one bad App can't take down your entire OS.

Ahammed Hafees
by Ahammed Hafees , Software Engineer Tech Lead , Trolley Kuwait

Android apps can be developed using java,C,C++,C#(XAMARIN),html(PhoneGap) ,python etc.Then why JAVA when Android OS has a linux kernel which is developed using c and C++?JAVA is the most popular language in computer science, we have a lot of developer using java  more than any other computer language.That is what Android team just wanted for the initial push of the OS.More developer means more apps, more apps means more publicity, so the best option was JAVA and they preferred it.

Rupa Evangeline
by Rupa Evangeline , Java consultant , Trakhees - unity info tech

Initially android was built using java architecture.
So the libraries it supported were mainly for java programming.
Android native development kit supports development in C and C++.
At present it also supports other scripting languages like python.

Nowadays, using Java as a programming language for Android development has become a choice rather than the only option.
New technologies appear everyday that let you create Android apps in the language of your choice.
- If you like web development you can try any of the frameworks out there that let you create your apps in Javascript + HTML + CSS, such as 'Titanium SDK', to name one.
These tools basically wrap all the web code (web pages) you write into a native APK file (Android application package) that will execute your code inside an embedded web browser, and leave them ready for you to upload to the Google Play market.
These tools give you as much flexibility as you want as they even wrap the phone's hardware capabilities (camera, GPS, etc.) in JS interfaces.
The only disadvantage is that all the code will run on a web browser and therefore will be slower than native code.
- If you're a C++ lover, thanks to the NDK you can write your whole application in that language.
It is however noted in the NDK documentation that just by programming in C++ will not boost the application performance.
You have to do a case-by-case study and consider the pros and cons of this approach.
- And finally my favorite.
If you like the .NET framework and the C# language you can give a try to Xamarin.
It is a framework created by the same people that made the Mono project (.NET for Linux) and that let's you create mobile applications for Android AND iOS in C# with the benefit of reusing a huge amount of code (what's known as cross-platform development) .
You will only have to focus on platform's specifics when dealing with the UI and maybe some of the hardware.
This platform is growing by the day and to me is the best approach at the moment when you want to start a serious mobile development project.
Finally, why is Java the preferred language for Android in the first place? Android is a linux-based system.
Java is an easily embeddable VM that is used massively in any kind of machine.
I guess that was one of the reasons to choose it over other technologies.
At the moment, though, there have been tests with other technologies such as a custom Mono framework VM for phones that have yielded better performance results than the current Java implementation.
Hope this helps!

Mohammed Gomaa
by Mohammed Gomaa , Senior Mobile Developer , Smart Dubai Government

Because java is native language for android development by using sdk 

Shahbaz Awan
by Shahbaz Awan , M2M IoT Software Architect , Wadi Makkah

android is a framework which run java applications on dalvik vm on Linux OS whereas we can also develop applications using c/c++ which run directly on Linux but developer have to write clean and manageable code so that application don't crash which is a bit risky whereas using java Linux will not crash because android already keenly ported on underlying Linux and handle these issues very carefully.

oussama rouane
by oussama rouane , stageur , sonatrach

java is a known language, developers know it and don't have to learn it

  • its harder to shoot yourself with java than with c, c++ code since it has no pointer arithmetic

  • it runs in a vm, so no need to recompile it for every phone out there and easy to secure

  • large number of developement tools for java (see first)

  • several mobile phones already used java me, so java was known in the industry

  • the speed difference is not an issue for most applications, if it was you should code in assembly

Abdul Azeem
by Abdul Azeem , Principal Engineer , Universal Inspection Co.LTD

Dalvik is the process virtual machine (VM) in Google's Android operating system.
Dalvik is an integral part of Android, which is typically used on mobile devices .
It is the software that runs the apps on Android devices, Once Android system is loaded.
Programs are commonly written in Java and compiled to bytecode.
They are then converted from Java Virtual Machine-compatible .class files to Dalvik-compatible .dex (Dalvik Executable) files before installation on a device.
DVM are typically optimized for the low memory requirements needed for mobile phone development and implementation of applications.
DVM is designed to allow multiple VM instances to run at once.

SADIK HUSSAIN PARAMBERI
by SADIK HUSSAIN PARAMBERI , Developer/Application Support , Riyad Bank

in Android,there is only change in platform and designing,but coding is extremely in java

NASSER AL-OSTATH
by NASSER AL-OSTATH , Co-Founder , www.pythonat.com

because java was built this way , i mean ti use java for applications. recently, google has approved Kotlin as an official programming language to build android apps. it is build over java and uses java virtual machine to run but it's easier to learn and more fun to tackle. i used it while practicing on it and build very simple apps to learn the kotlin language. its so cool. i highly recommend it.

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.