Android is a leading mobile operating system worldwide, having a global market share of over 71%, leaving the competitors like Apple’s iOS, windows, etc., far way behind. It runs on a wide variety of platforms, and its powerful features contribute to its success.

This Android tutorial/Android Studio tutorial covers basic to advanced-level Android concepts and is developed for both beginners and experienced.

If you would like to Enrich your career with an Android Certified Professional, then visit Mindmajix - A Global online training platform:  "Android Training”  Course.  This course will help you to achieve excellence in this domain.

Introduction to Android

Android is a Linux-based operating system designed especially for mobile-based touch screens such as smartphones and tablets. This operating system has developed a lot in the last 15 years and soon became the most popular operating system for mobile apps with its advanced features.  It’s the operating system inside 2.5 billion active devices. From stunning tablets to 5G phones, Android powers them all.

Open Handset Alliance developed Android and later commercially led by Google. Android is based on the Java programming language, and if you possess knowledge of it, it’s easy to learn Android application development.

What is Android?

Android is a mobile-based operating system based on Linux Kernel’s modified versions and other open-source software. Android is free to use and open-source software. Android is licensed under the Apache License, and its source code is Android Open Source Project (AOSP).  

Android was released on 23 September 2008, and Android 11 is the latest version. 

RELATED ARTICLE :- ACTIVITY LIFECYCLE IN ANDROID

Android History

The history of Android begins in Oct 2003. Four members, namely Rich Miner, Chris White, Nick Sears, and Andy Rubin, found Android in Palo Alto, California.

In 2005, Google acquired Android. Since then, it has been a subsidiary of Google Incorporation. 

Android Versions 

The codenames of Android ranges from A to P currently. API Level is an integer that distinguishes the framework API revision offered by a version of the Android platform. The following table shows the sequence of Android versions, along with their codenames and supported API levels.

Version

Codename

A2PI Level

11

Android11

30

10

Android10

29

9

Pie

28

8.1.0

Oreo

27

8.0.0

Oreo

26

7.1

Nougat

25

7.0

Nougat

24

6.0

Marshmallow

23

5.1

Lollipop

22

5.0

Lollipop

21

4.4 - 4.4.4

KitKat

19

4.3.x

Jelly Bean

18

4.2.x

Jelly Bean

17

4.1.x

Jelly Bean

16

4.0.3 - 4.0.4

Ice Cream Sandwich

15

4.0.1 - 4.0.2

Ice Cream Sandwich

14

3.2.x

Honeycomb

13

3.1

Honeycomb

12

Subscribe to our youtube channel to get new updates..!

3.0

Honeycomb

11

2.3.3 - 2.3.7

Gingerbread

10

2.3 - 2.3.2

Gingerbread

9

2.2.x

Froyo

8

2.1

Eclair

7

2.0.1

Eclair

6

2.0

Eclair

5

1.6

Donut

4

1.5

Cupcake

3

Android Features

The Features of the Android operating system are listed below:

Type

Feature and Description

General

Supports SMS and MMS through messaging feature. 

Android supports an exciting feature called auto-correction for word misspell and dictionary to add, edit and remove words.

Voice-based features like calling, texting, navigation, etc., are supported on Android 2.2 onwards.

The multi-touch is made available in handsets such as the HTC Hero.

Multi-tasking of apps is available.

Android supports Screen capture, TV recording, and video calling.

Supports multiple languages

Connectivity

Android supports connectivity technologies like Bluetooth, Tethering, GSM/EDGE, CDMA, LTE, UMTS, EV-DO, IDEN,  NFC, and WiMAX.

Wi-Fi Hotspot allows you to discover and pair apps directly over a high-bandwidth peer-to-peer connection.

Media

Android supports various media formats, including WebM, H.264, H.263, HE-AAC, AAC, and more.

Android supports USB flash drives and USB HDDs, and USB-OTG cables to allow usage of external storage.

Other

The platform works for various screen sizes and can potentially connect to any external screen.

You can work with J2ME via third-party applications (Java).

Allows instant apps creation

Android apps are written in HTML (Native apps).

SQLite, a lightweight relational database, is used for data storage purposes.

Android Beam allows you to share just by touching two NFC-enabled phones together instantly.

Android Installation

The best thing about Android is that anyone can set up an Android environment on any operating system. 

Another exciting thing is that all the tools used for developing applications are freely available and downloaded from the web.

Before you get started with your Android application programming, make sure you installed the following software’s:

  1. JDK (Java Development Kit)

  2. Android Studio

  • Once it's there in your system, go ahead and follow the process to install the latest Android Studio version. Go to the link: https://developer.android.com/studio and click on download Android Studio.



Android Architecture

An android operating system is a software stack of different layers, in which each layer groups several programs together. Each layer in the architecture provides various services to the layer just above it.

The below diagram shows the major components of the Android platform.

Following are the different layers in the Android software stack:

  1. Linux Kernel Layer

  2. Hardware Abstraction Layer (HAL)

  3. Native Libraries Layer

  4. Android Runtime

  5. Java Application Framework Layer

  6. System Apps Layer

 

1. Linux Kernel Layer

The foundation of the Android platform is a Linux Kernel. Its importance stems from the fact that it supports the underlying functionalities of Android Runtime (ART), security settings, memory management programs, shared libraries, other hardware drivers, and more. With the evolution of Android, the Linux Kernels it runs on have evolved too.

The below table highlights different Linux Kernels versions:

Android Version

Linux Kernel Version

1.0

2.6.25

1.5 (cupcake)

2.6.27

1.6 (Donut)

2.6.29

2.2 (Froyo)

2.6.32

2.3 (Gingerbread)

2.6.35

3.0 (Honeycomb)

2.6.36

4.0.x (Ice Cream Sandwich)

3.0.1

4.1./4.2 (Jelly Bean)

3.0.31

2. Hardware Abstraction Layer (HAL)

This layer provides standard interfaces that exhibit device hardware competencies to the higher-level Java API framework. HAL consists of different library modules, each of which applies an interface to the hardware component’s particular types.

3. Native Libraries Layer

Another layer in the architecture is Android’s Native Libraries. A library passes a set of instructions to the device for handling different data types.

Open-source libraries include Surface Manager, SGL, Media Framework, Free Type, WebKit, SQLite, and more.

4. Android Runtime Layer

It’s located on the native libraries layer and includes a set of Java libraries. It provides a unique component called Dalvik Virtual Machine, a Java Virtual Machine’s type specially optimized for Android.

Additionally, the Android runtime supports a set of core libraries enabling android app developers to write apps in the Java programming language.

5. Java Application Framework Layer

The entire feature-set of Android OS is available through APIs written in Java programming language. They form the core building blocks of Android application development. Essential blocks of application framework are:

  • View System - Used to build applications UI, including grids, lists, buttons, text boxes, and more.

  • Resource Manager - Provides access to non-code resources such as localized graphics, strings, and layout files.

  • Notification Manager - Displays custom alerts.

  • Activity Manager - Manages application lifecycle and provides a navigation back stack.

  • Content Providers - Provides data access to other apps.

6. System Apps

System apps are at the topmost layer of the Android stack. They function both as applications for users and provide critical capabilities that developers can access from their app.

Android Application Components

An Android component is simply a piece of code that has a well-defined life cycle. The core building blocks or fundamental components of an Android application are 

  1. Activity
  2. Services
  3. Content Providers
  4. Broadcast Receivers
  5. Manifest

1. Activity

An activity is a class that is represented as a single screen and considered as an entry point to users. Usually, an app contains many screens, and each screen extends the Activity() class.

An app can have different activities, and each one is independent of one other. For example, a Grammarly start page where you enter your email and password to login acts as an activity.

To implement an activity, extend the activity class  in your subclass as follows:

public class MainActivity extends Activity {
//code
}

Activity Life Cycle

An Android activity can have four states: Running, Paused, Resumed, and Stoped during its entire life cycle. To describe each activity in each of its four states, Android supports callback methods.  There is a sequence of callback methods that starts up an activity and break down into different methods, as shown in the diagram above:

  • onCreate() - This is the first callback and called when activity is called.

Syntax: 

@Override protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
...
}
  • onStart() - This is the second callback and called when the activity becomes visible to the user.

Syntax:

@Override protected void onStart()
{
super.onStart();
...
}
  • onResume() - When a user starts interacting with the application, this callback is called.

Syntax:

@Override protected void onResume()
{
super.onResume();
...
}
  • onPause() - This callback is invoked when an activity doesn’t receive any user input and goes on hold.

Syntax:

@Override protected void onPause()
{
super.onPause();
...
}
  • onStop() - This callback is invoked when the callback is no longer visible to the user.

Syntax:

@Override protected void onStop()
{
super.onStop();
...
}
  • onDestroy() - When an activity finishes and the user stops using it, this callback is called.

Syntax:

@Override protected void onDestroy()
{
super.onDestroy();
...
}
  • onRestart() - When an activity is about to start from a stop state, this callback is invoked.

Syntax:

@Override protected void onRestart()
{
super.onRestart();
...
}

2. Services

A service is a component used to perform long-time running operations in the background. It keeps updating activities, data sources, broadcasts intents, and even conducts the tasks when apps are not active. 

An example of service is browsing the internet while still listening to music(usage of another app).

Extend service class in a subclass to execute services:

public class MyService extends Services {
//code
}

A service can take two states, namely Started and Bound.

A service lifecycle has specific callback methods to monitor changes in the services state.

Callback

Description

onStartCommand()

This callback is invoked when another component invokes the service started by startService().

onBind()

When another component wants to bind with the service by calling bindService(), this callback is invoked.

onUnbind()

When all the clients have disconnected from the interface, this callback is called.

onRebind()

When new clients are connected, we use this callback.

onCreate()

When the service is first created using onStartCommand() or onBind(), this method is called.

onDestroy()

When service is destroyed and no longer used, this method is invoked.

3. Content Providers

Content Provider is a component that allows data sharing from one application to others on request, and the methods of the ContentResolver class handle those requests. It hides the database information and reads and writes private data of an application that is not shared.

Without content providers accessing data from other applications would become a mess.

Extend ContentProvider in your subclass, to implement this:

public class Provider_Name extendsContentProvider {
//code
}

4. Broadcast Receivers

Broadcast Receiver is a component that responds to broadcast messages from the same system or another application. These messages are called events or intents. A broadcast receiver is used by the app when they perform execution based on system events. It acts as communication between the Android operating system and applications.

Broadcasts can also be delivered to apps that are not running.

Extend BroadcastReceiver to your receiver, to implement this:

public class Broadcast_Name extendsBroadcastReceiver {
//code
}

5. Manifest

The manifest files describe basic information about your app to the Android build tools and operating system. It performs various tasks such as:

  • Naming the app’s Java package as the package name works as a unique identifier for the app.
  • Declares the minimum level of the Android API and lists the libraries which are linked with the application.
  • Declares permissions to access the application’s APIs and interact with other apps.

Some additional components of the Android Application:

1.  Intents 

Android intent is an abstract description of an operation to be performed. It is used to transfer data between activities and start a new service, and display a list of contacts in ListView. For communication between android components, intent works like an inter-application message passing framework. An example of intent is the camera app sends an intent to the system when the user wants to share a picture.

 2. Widgets 

Android widgets are variations of Broadcast receivers and fundamental aspects of home screen customization.  They present data and allow users to implement actions on them. Types of widgets that Android application components support are information widget, collection widget, control widget, and hybrid widget.

3. Views 

The basic building block of  Android is View, which is responsible for event handling and drawing. Some of the views are ImageView Button, ImageButton, EditText, and CheckBox. 

4. Notifications 

Informs the user when the app is inactive or not visible.

5. Fragments 

A fragment is a piece of an activity that enables a more modular activity design. Users can join more than one fragment in a single activity, and these fragments can be reused in various activities. It generally contains Views and ViewGroups inside them.

6. Layout XML Files 

It’s the structure of the user interface in the application. Android supports various types of layouts.

7. Resources 

To define string values, texts, etc., Android uses resources.

Conclusion:

With this, we have come to the end of this Android Tutorial. Nowadays, most of them own smartphones and apps where the majority of their time spent. In fact, billions of Android apps were downloaded every year, assuring that the Android career is a stable one with lots of opportunities. 

If you want to develop an Android App, consider getting started with Mindmajix’s Android Certification Training course. The course is aligned with Google’s Associate Android Developer (AAD) Exam and covers everything from scratch.