Home  >  Blog  >   Android

Android Tutorial

Android has tremendous growth across the globe with a diverse community. It's open to everyone: designers, developers, and device makers. But do you know how it works? In this Android tutorial, you’ll learn about Android fundamentals like architecture, features, versions, installation, and more.

Rating: 4.6
  
 
3129

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.

Android Tutorial for Beginners

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 was 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.

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

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

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

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. 

Subscribe MindMajix YouTube Channel

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.

VersionCodenameA2PI Level
11Android1130
10Android1029
9Pie28
8.1.0Oreo27
8.0.0Oreo26
7.1Nougat25
7.0Nougat24
6.0Marshmallow23
5.1Lollipop22
5.0 Lollipop21
4.4 - 4.4.4KitKat20
4.3.xJelly Bean19
4.2.xJelly Bean18
4.1.xJelly Bean17
4.0.3 - 4.0.4Ice Cream Sandwich16
4.0.1 - 4.0.2Ice Cream Sandwich15
3.2.xHoneycomb14
3.1Honeycomb13
3.0Honeycomb12
2.3.3 - 2.3.7Gingerbread11
2.3 - 2.3.2Gingerbread10
2.2.xFroyo9
2.1Eclair8
2.0.1Eclair7
2.0Eclair6
1.6Donut5
1.5Cupcake4

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

Java Development Kit

  • 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 Studio

For More Info: Installation of Android

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.

Android Architecture

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 others. For example, a Grammarly start page where you enter your email and password to log in acts as an activity.

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

public class MainActivity extends Activity {
//code
}

Android Activity Life Cycle

Android 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  iscalled when activity is called.

Syntax: 

@Override protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
...
}
  • onStart() - This is the second callback and is 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.

CallbackDescription
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 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.

Related Article: Top Android Interview Questions and Answers

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 is 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.

Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
Android TrainingApr 27 to May 12View Details
Android TrainingApr 30 to May 15View Details
Android TrainingMay 04 to May 19View Details
Android TrainingMay 07 to May 22View Details
Last updated: 24 Apr 2023
About Author

 

Madhuri is a Senior Content Creator at MindMajix. She has written about a range of different topics on various technologies, which include, Splunk, Tensorflow, Selenium, and CEH. She spends most of her time researching on technology, and startups. Connect with her via LinkedIn and Twitter .

read more
Recommended Courses

1 / 15