Java is the technology of choice for building applications using managed code that can execute on mobile devices.
Android is an open source software platform and Linux-based operating system for mobile devices. The Android platform allows developers to write managed code using Java to manage and control the Android device. Android applications can be developed by using the Java programming language and the Android SDK. So, familiarity with the basics of the Java programming language is a prerequisite for programming on the Android platform. This article discusses where Java fits in mobile application development and how we can use Java and Android SDK to write applications that can work on Android devices.
The Choice of Java
What made Java be the technology of choice for mobile development for the Android platform? The Java Programming Language emerged in the mid-1990s; it was created by James Gosling of Sun Microsystems. Incidentally, Sun Microsystems was since bought by Oracle. Java has been widely popular the world over, primarily because of a vast array of features it provides. Java's promise of "Write once and run anywhere" was one of the major factors for the success of Java over the past few decades.
Java even made inroads into embedded processors technology as well; the Java Mobile Edition was built for creating applications that can run on mobile devices. All these, added to Java's meteoric rise, were the prime factors that attributed to the decision of adopting Java as the primary development language for building applications that run on Android. Java programs are secure because they run within a sandbox environment. Programs written in Java are compiled into intermediate code known as bytecode. This bytecode is then executed inside the context of the Java Virtual Machine. You can learn more about Java from this link.
Using Java for Building Mobile Applications
The mobile edition of Java is called Java ME. Java ME is based on Java SE and is supported by most smartphones and tablets. The Java Platform Micro Edition (Java ME) provides a flexible, secure environment for building and executing applications that are targeted at embedded and mobile devices. The applications that are built using Java ME are portable, secure, and can take advantage of the native capabilities of the device. Java ME addresses the constraints that are involved in building applications that are targeted at mobile devices. In essence, Java ME addresses the challenge of executing applications on devices that are low on available memory, display, and power.
There are various ways to build applications for Android devices, but the recommended approach is to leverage the Java programming language and the Android SDK. You can explore more about the Android SDK Manager from here.
The Dalvik Virtual Machine (Dalvik VM)
The Android platform leverages the Dalvik Virtual machine (Dalvik VM) for memory, security, device, and process management. Although the internal intricacies of how the Dalvik Virtual Machine works is not that important to an average developer, you can think of the Dalvik VM as a box that provides the necessary environment for you to execute an Android application sans the need of having to worry about the target device.
To get started using Java for Android, you should first download and install Android Studio. You then may want to take advantage of the SDK Manager to download and install the latest SDK tools and platforms.
Programs that are targeted at the Android platform are written in Java and executed by the Dalvik Virtual Machine (DVM). In this article, we have had a look at how and why Java fits in as far as the mobile application development industry is concerned. I will discuss more on how you can build applications using Java for Android devices in another article here. Happy reading!