Hey buddy I’m Junaid, and this is 1st tutorial of Android SDK Essential Training in which, I have explain about the Android Architecture In details. I’m creating this course for the beginners so that they can create their own application from the scratch. Let’s started this.
As an Android developer it’s good to have at least a basic understanding of the architecture of the operating system and the rest of the platform.
The base of Android is a kernel that’s built around Linux it’s a version of Linux that’s highly optimized for mobile operating systems made as small as possible so that it works well on devices that have very seriously constrained CPU and memory capabilities.
On top of the kernel is the Android runtime and a set of libraries that enable the behavior of the operating system itself.
The next level is the application framework which sits on top of the Android runtime and the associated libraries.
And then finally at the top are the apps including those that are included with the operating system and custom apps.
That you might download from the Google Play Store or build yourself let’s break down each of these layers.
The Linux kernel again starts with Linux itself. But then also has a set of drivers and each driver is designed to interface with an element of the hardware a phone or a tablet . For example you’ll have drivers for audio camera, display the keypad to manage flash memory, power, Wi-Fi, and so on it’s up to the OEMs that is the manufacturers of the devices, themselves. To customize these drivers and make them work for those devices, so if you’re holding an Android device in your hand, the version of Android that’s on that device will be a combination of what Google delivers and what the vendor delivers.
The next layer is the Android runtime, and this includes a set of core libraries, and critically the dalvik virtual machine, the dalvik virtual machine or JVM replaces the JVM, that’s used in conventional Java based applications, dalvik again is highly optimized for very small devices and the byte code that it reads is different in many ways, from the byte code that’s generated by conventional java compilers, so to get dalvik byte code you have to use the dolphin compatible compiler, that’s included with the Android developer tools.
The associated libraries include libraries, to manage all sorts of features of Android, including graphics databases, encryption typefaces, and so on, these libraries work at the same level of the software stack, as the core runtime, but they’re expandable and so device makers can add their own libraries to this layer.
The next level is the application framework, and it has modules for controlling all the different components of your apps, including activities, which represent the screens that the user sees, content providers to manage data, and move that data between apps, locations notifications, windows resources, telephone management, and so on.
And finally there are the apps, each version of Android have been delivered with an expanded set of included apps, but at minimum every version of Android had a home screen, a browser , contact management, phone management, and a few other things, as of the most recent version of Android, Android 4.4 KitKat, there’s a full productivity suite, now included so more , and more new apps are included with each new version of the operating system, but you can add as many apps to this layer as you want, once again including both those apps that you can get from the store, but also the apps that you build yourself.
As a developer, you’ll be putting together your apps, based on components, and there are four major types of components, that you’ll be working with.
Activities are the screens themselves, this is what the user sees a single activity, can either take up an entire screen, or a portion of a screen, as you’ll see in a moment, an activity is represented by a Java class in your programming, but what the user sees, is just an application screen.
A widget is a smaller component, each widget can be used to manage display, and user interactivity, and either to display or to collect data, but if you take many widgets, put together you end up with a screen, and you’ll see, how activities use layouts, and how layouts use widgets.
Services are a special kind of component, that perform background jobs, services by their nature are invisible, the user doesn’t see them, but they can run in the background, even while the user is running an app in the foreground.
And broadcast receivers, can react to system messages, that are dispatched by the operating system, and by other apps.
Each component in an Android app, is implemented as a Java class, you’ll have both the Java classes, that are included in the SDK, and your own custom Java classes.
Here’s an example, as I previously mentioned, an activity represents a screen, or a portion of a screen, in an Android app, and it’s an instance of a Java class, named android.app.activity.
And here’s another example, a button, when you add a button to a screen, it’s because you want the user, to be able to touch, or click it, and a button in Android is an instance of a Java class, named Android.widget.button, this just scratches the surface, there are thousands of different Java classes, in the Android SDK, and again you’ll be creating, your own Java classes to represent the components, of your app because you’ll be working with Java, it’s important to understand, which version you’ll be coding in.
The compiler, that builds byte code, for the dalvik JVM, uses an Android specific Java implementation, it doesn’t precisely map to any specific version, of Oracle’s Java, instead you’ll find that, androids Java uses primarily Java 5 APIs, with a smattering of java 6.
If you’re a Java developer, who’s moved on to Java 7, or even eight, you’ll find as of the time of this Tutorial, that the features, that are new to those versions of Java, are not available in android.
For example, Java features, like to try with resources, the switch statement, with string values, or multiple catch clauses, that were introduced, in Java 7, are not known to Android’s java compiler, and similarly the newest features, that are available in java SE 8, such as lambda expressions, and the new date time API, have not been implemented, for Android , again as of the time of this Tutorial.
So, if you’re an experienced java developer, go back to your java 5, and java 6 experiences. Code the way you coded, for those versions of Java, and you’ll be in good shape, and if you forget, and if you try to use a construct, or a part of an API, that was only available, to later versions of Java, the Android developer tools, will correct you quickly.
I hope you will enjoyed this article and Video explanation, I have to spend couple of hours to make over this video and article. Stay update with my blog for the next tutorial about Android SDK Installation.