In recent time, an android development application system is emerging as a top mobile application development tool. In this mobile application era, I must say there is a huge demand for Android developers. Because of this reason, most tech-savvy employers are eager to pursue their careers as android developers. In this Android tutorial, we are going to explain basic to advanced concepts, this might help for both fresher as well as an experienced professional. All the contents related to this tutorial are designed under the guidance of industry experts and the SME team. Are you ready to learn this amazing mobile application development tool? So what you are waiting for, let’s begin;
Android is one of the popular open source operating systems and most commonly used in the development of smartphones and tablets. The Android operating system is developed on the basis of the Linux kernel platform-based. With the help of this mobile operating system, the developers can develop any type of functions and programs; this performs basic to advanced level operations. As per the latest Gartner report, almost 53% of tech companies make use of this tool to develop the various applications using Android operating systems.
Android software development is the process by which new applications are created for the Android operating system. These types of applications are developed using JAVA programming language using Android software development kit (SDK). The Android software operating system was first developed by “Google” company. Android Software development tool kit is composed of various modular packages. Once Google releases the new Android version, a corresponding software development kit is also released to write java related mobile application programs with the latest features.
As I said earlier, Android was first developed by the company “Google” and the code names of android starting from A to J. We will discuss them later.
1. Initially, “Andy Rubin” first founded Android Incorporations in California, Palo Alto, the United States in the year 2003 October.
2. On 2005 August 17th, Google company acquired this Android Incorporation. Since then, this is considered a subsidiary of Google Incorporations.
3. The key employees of this company are “Andy Rubin”, “Rich Miner”, “Nick sears”, and “Chris White”.
4. First they were designed only for Camera purposes but later shifted to smartphones due to the low market for cameras by that time.
5. Android is the nickname of the owner “Andy Rubin” given by his coworkers due to his love for robot applications.
6. In 2007, Google first announced the development of Android Operating systems.
7. In 2008, HTC launched its first android mobiles.
Android version-> 8.0 ->Oreo
Android version 7.0-7.1.2 -> Nougat
Android version 6.0-6.0.1 -> Marshmallow
Android version 5.0-5.1.1 -> Lollipop
Android version 4.4 -4.4.4 -> Kitkat
Android version 4.1-4.3 ->Jelly bean
Android version 4.0- 4.0.4 ->Ice cream sandwich
The following are the key factors that make Android the most popular mobile application development tool.
The key factors are as follows:
1. Experienced Android developers enjoy working with this highly flexible technology and its endless possibilities of developing robust mobile applications.
2. Android SDK supports GSM, EDGE, CDMA, Bluetooth, EVDO, and Wi-Fi to send/ receive data across mobile networks and offers a wide range of package libraries for 2D, 3D graphics, audio-video files, and images.
3. Receiving automatic, unattended updates to the operating system and applications as well as making multiple aliases for mobile applications are important featured loved by Android developers.
4. Being free enabled Google to join hands with many leading hardware manufacturers and bringing out smartphones within budget.
5. Android gives you a world-class platform for creating applications and games for Android users everywhere, as well as an open marketplace for distributing to them instantly.
Android architecture is designed on the base of the Linux kernel operating system and this overview will explain the functionalities, components, and work nature. The following diagram explains the overall architecture overview of Android:
The following are the basic components of Android:
This is the heart of android architecture that is located at the root of Android development architecture. This Linux kernel performs activities like device drivers, memory management, resource access, power management, and device management.
On the top of the Linux kernel, you can see Native libraries namely WebKit, SQLite, OpenGL, media, Free type, and C runtime library or libc, etc. The WebKit library is used for supporting browsers, SQLite database support, media for playing audio and video data stream, and free type font support.
Android runtime consists of core libraries and DVM or (Dalvik virtual machine) mainly used to run android applications. DVM is a type of java virtual machine (JVM) mainly used to optimize mobile devices. This type of android runtime consumes less memory and offers fast performance.
This is located on the top of native libraries and android runtime. Android framework consists of Android Application programming interface (API’s) like a user interface (UI), resources, locations, telephony, data providers, and package managers. It offers a lot of interfaces and classes to develop android applications.
Applications exist on the top of an android framework. Applications like home, games, browsers, and settings use the android runtime and libraries. Both android runtime and native libraries use the Linux kernel.
In this section, we are going to explain the how-to to set up an Android environment;
a. Here you can start Android application development with the help of the following operating systems;
1. Microsoft Windows XP or recent versions.
2. Mac operating system version X 10.5.8 or later versions consist of Intel Chip.
3. Linux operating system including GNU C Lib 2.7 or later versions.
b. In this section, you have to concentrate on tools to develop android applications, which are freely available and the user can be downloaded from the web browsers. Below is the list of software required to start android application programming:
1. JAVA JDK5 or any recent versions
2. Android studio development
c. The below are the key components, mainly used to develop java based application development. If you are working on Windows operating system, these components are easy to use and run.
d. Setting up of the Java development kit (JDK):
1. The First download the latest version of Java JDK from oracle’s Java site -> download the JAVA software engine.
2. Now you will get all the required details to install JDK to download the files -> then follow the instructions to install and configuration set up.
3. Finally set up the PATH and JAVA_HOME environment variables to store them directory that consists of JAVA and JAVAC, typically there are two files java_install_dir/bin and java_install_dir respectively.
4. If you are working on Windows and then you to install the JDK in the directory C:\jdk1.8.0_102, and follow the below syntax:
set PATH = C:\jdk1.8.0_120\bin; %PATH%
set JAVA_HOME = C:\jdk1.8.0_120
5. Then right click on my computer -> select properties -> then advanced -> then select environment variables.
6. You need to update the PATH values -> then press the OK button.
7. If you are working on Linux, if the SDK already installed in the dire /usr/local/jdk1.8.0_102 -> you can view the C shell ->all the required files are stored in the .cshrc file.
setenv PATH /usr/local/jdk1.8.0_102/ bin:$PATH
setenv JAVA_HOME /usr/local/JDK 1.8.0_102
If you are using Android studio -> then it will run automatically that installed on JAVA.
There are various sophisticated technologies are available to develop android mobile applications, the below are the familiar technologies, which we are using now:
1. Android studio
2. Eclipse IDE or Deprecated.
Android core building blocks:
Android core components are nothing but a simple piece of code that has well-defined software life cycle features like Activity, receiver, and service, etc.
The following are the core and fundamental components of android application development:
5. Content providers
7. Android manifest.
1. Activity: An activity is a type of class that mainly represents a single screen. This is like a Frame available in AWT.
2. Views: A View is a user interface component such as button, text fields, and Label, etc. Anything that the user sees on the screen is a View.
3. Intent: The intent component is used to invoke components. The main purpose of intent:
a. Start the service that is required
b. Launch the activities
c. Displaying of web pages
d. Displaying of contact lists
e. Broad cast of a message
f. Dialing a phone call.
To View the intent component you can use the following code:
Intent intent = new Intent (Intent.ACTION_VIEW);
Intent.setData (uri.parse (http://www.android.com));
Service is another component of the Android application and used for the background process that runs for a long time. There are mainly two types of services available; local and remote. Local service access data within the application whereas remote service access data remotely from other applications that are running on the same device.
5. Content provider:
Content providers are mainly used to sharing the data between the android applications.
The fragment is also a part of the activity and any activity displays one or more fragments on the visible screen at the same time.
This component contains various information like activities, permissions and content providers, etc. It is like a web.xml file located in JAVA EE.
8. Android Virtual Device (AVD):
This component is used to test the android applications without the use of mobiles or tablets etc. This android virtual device can be created in different configurations to process various types of real devices.
An android emulator is a type of Android virtual device (AVD), which represents the specific android device. Android emulator can also be used as a target device to execute, test, and run the application on your personal computers. The Android emulator is used to offer the functionality to a real-time device. So with the help of an Android emulator, we can get incoming calls and text messages. It also specifies the different network workplaces and also accesses the google play store and many more google default apps.
Testing any android emulator application is easier and faster than another real device. An android emulator includes predefined configurations for various android phones, android tv devices, tablets, and wear OS.
The Android emulator can be installed while installing android studio on any operating system. In some cases, some components of the emulator may or may not be installed while installing android studio.
The navigation is as follows:
To install the emulator component -> select the Android emulator component from the SDK tools -> SDK manager.
There are more items required to build a good android application. Many users prefer to develop an android mobile application without the use of any codes and they simply go with resources like static content such as bitmaps, layout definitions, User interfaces, and animation strings, etc. These resources are maintained separately in various android directories located in the res/directory of the given project.
Here the XML file that defines the animation properties. Usually, they are saved in any res/color and these are accessed from the R. Anim class.
The XML file that defines a state of list colors and they are saved in res/color and access them from the R. Color class.
This directory is used to store the images like .png, .jpg,.gif, and XML files that are stored as a bitmap, state lists, animation drawable, and shapes. Usually, they are saved in res/drawable/ and access from R. Drawable class.
XML files consist of user interface layouts. They are saved in res/layout/ and access from R. layout class.
XML files specify the application menus, namely options menu, sub-menu, and context menu. Usually, they are saved in res/menu and access from the R. menu class.
Here arbitrary files are saved in the raw form. Users need to call Resources.openRawResources () with the resource ID, and stored in R raw. Filename.
An XML file also consists of values in the form of strings, integers, and colors. For example:
a. array.xml used to store only array values.
b. integers.xml used to store resources integers.
c. bools.xml used to store resource Boolean values.
d. colors.xml used to store dimension values.
e. string.xml mainly used to store string values.
f. styles.xml used to store styles, and fonts.
Arbitrary XML files used to read at runtime applications by calling resources.getXML (). Here you can also store various configuration files that run at run time.
First, we will discuss Android activities;
As I said earlier, activities are an important fundamental component of Android application development. This activity represents the single screen with user interfaces like Windows or frameworks. Android activity is a subclass of the method “context Theme Wrapper”.
If you have already worked with programming languages like C, JAVA, and C++, then every program should start with the main() function. In the case of the android program, it initiates with an activity starting with the onCreate () callback method. You can see the sequence of callback methods should start with activity and sequence of call back methods as shown in the below diagram;
Here we would like to mention few callback activities and descriptions:
1. OnCreate ():
This is the first-ever call back activity and called when you created your activity functions.
2. OnStart ():
You can call this call back when the created activity is visible to the users.
3. OnResume ():
This is called when the users started interacting with the given application.
4. OnPause ():
Here this paused android call back activity does not receive any users’ inputs and also cannot execute the codes and you can call them when the current activity is paused and previous activity being resumed.
5. OnStop ():
This call-back activity is called when the already created activity is no longer visible to the users.
6. OnDestroy ():
This call back activity is called before the existing activity is destroyed by the system.
7. OnRestart ():
This call back activity is called when the activities restart after stopping them.
Service is also an important component of android that runs only in the background to perform long-running operations without any user interaction required. One important point to be noted here, this service works even if any of the android applications are destroyed.
There are two types of services available:
A service can be started when the application component such as activity starts by calling the method startservice (). Once started this activity, a service can run in the background, even if the component is destroyed.
A service is bound when the application components bind to it by using the method called bindservice (). A bound service specifies the client-server interface that allows each android component to interact with the service, get results, and send requests. With the help of this service type, users can also process with interprocess communication (IPC).
The following diagram explains the service life cycle:
This service life cycle consists of callback methods that are used to implement monitor changes in the service state and you can also perform the required task at the appropriate stage. Each service should be created with the help of a method called startService () and this can run by using bindservice ().
The following are the important service components and description:
1. OnstartCommand ():
The system calls this service method when another component (like activity), and requests the service will be created by calling a method called StartService (). Once you implement this method, it’s your responsibility to stop the service when the work is done, you can stop the method by using stop self () or stopService () methods.
2. OnBind ():
The system calls this method to bind the component with the service by using a method called bindService (). If you want to implement this method, you should provide an interface to communicate with the clients and return the object called IBinder.
3. OnUnBind ():
The system calls this method when all the clients are disconnected from a specific interface that is published by the service.
4. OnRebind ():
The system calls this service method when the new clients have been connected to the service and previously have been notified that all the methods had disconnected in the OnUnbind ().
5. Oncreate ():
The service system calls this method when you first created the services with the help of methods called OnstartCommand () or OnBind ().
6. OnDestroy ():
This service method is called when service is no longer required and is being destroyed. The applications must use this method to implement the resources for the cleanup process; the resources may be threads, receivers, and registered listeners, etc.
Broadcast Receivers are used to respond to broadcast messages from other applications or from the system itself. These types of messages are also known as “events” or “intents”.
There are two types of broadcast receivers’ methods available:
1. Creating the broadcast receiver.
2. Registering the broadcast receiver.
Let me explain them one by one;
1. Creating the broadcast receiver:
A broadcast receiver is implemented with the help of a subclass namely the “BroadcastReceiver” class and overrides them by using method OnReceive () method. Here each message can be received as an intent object parameter value.
2. Registering the broadcast receiver:
Here each application listens to the specific broadcast intent with the help of registering a broadcast receiver which is located in the directory called Androidmanifest.xml file. User can also register MyReceiver for system-generated intent ACTION_BOOT_COMPLETED; this can be fired by the system application and completes the boot process as shown below:
A content provider is a type of component that supplies the data from one application to another. Here data transmission can be done on requests and these kinds of requests can be handled by the method “Contentresolver” class. A content provider is available in a different way to store the data and data can be stored in a database, or in files.
The following diagram explains the content provider mechanism:
Sometimes, it is required to transfer the data across multiple applications. This is the reason why the android application needs content providers. These content providers behave similarly to a database where users can query it, add, delete, and edit them. The methods used are insert (), update (), query (), and delete (). In most cases, the data is stored in an SQLite database.
To create a content provider you have use this URL:
<prefix>: //<authority> /<data_type> / <id>
Here is the detail of this URL:
1. prefix: this is always used to set the content: //
2. Authority: This defines the content provider name, for example, browsers, and contacts. To define any third-party content providers, you should specify them with a fully qualified name.
3. Data_type: this defines the type of data being used, for example, Contacts used to get all the contacts and call logs used to define the calls you are getting (incoming and outgoing calls).
4. Id: this parameter defines the specific data record you required.
The following are the different methods used in Content providers:
1. Oncreate (): this method is called when the content provider begins.
2. Query (): this method is used to receive the request from a client. This result is later known as a Cursor object.
3. Insert (): this method used to add a new record into the content provider.
4. delete (): this method is used to delete an already existing data record from the content providers.
5. Update (): this method is used to update an existing record from the content provider.
6. getType (): this method is used to return the MIME data type at the given URL.
In recent times, almost 65%-70% of people use android devices because of their flexibility, scalability, and user-friendly characteristics. An android mobile application development emerging as a popular mobile application and dominating the mobile market with its latest advanced features. This android mobile market gives tough competition to IOS, blackberry, and HTC mobile application system. The android tutorial is designed to help those who want to learn and master mobile application developments. We have explained major concepts like architecture, content providers, receivers, services, and architecture overview. I hope this tutorial may help both freshers as well as experienced professionals and you can expect huge demand for android developers.
Batch starts on 18th Apr 2021, Weekend batch
Batch starts on 22nd Apr 2021, Weekday batch
Batch starts on 26th Apr 2021, Weekday batch
5th April | 08:00 AM