Android Tutorial

Lead by Google, Android is a Linux kernel based operating system.

Android Tutorial

Learn Android with this most complete Android tutorial in a quick and easy way. Useful for beginners, this tutorial explains all the basic concepts with examples that you would need to gain confidence with Android programming.

Who is this Android Tutorial designed for?

This tutorial will be very useful for all beginners wanting to grow their skills in Android Programming. Freshers, BCA, BE, BTech, MCA, college students will also find it useful to develop notes, for exam preparation, lab exercises, assignments and viva questions. By the end of this tutorial you will have a good idea about Android and will be ready to move to a higher level.

What do I need to know to begin with?

Since Android Programming has its based in Java Programing, a fair knowledge of Java will help you quickly pick up Android.

Android syllabus covered in this tutorial

This tutorial covers:

Android Activity Life Cycle, Architecture, Structure, Graphics, SQLite Database, Internal Storage, Event Handling, Gravity, AlertDialog, LinearLayout, ListView with Adapter, Spinner Control, Toast Message

This is almost everything you would require to learn about Android at this level. So, let's get started!

Introduction to Android

Android is an operating system which is based on the Linux kernel. Android system is also called as Android Open Source Project (AOSP), lead by Google. Android is used for mobile devices, such as smart phones and tablet computers. The Android application makes life more comfortable and advanced for the users.

Features of Android

android feature

The above diagram shows some features of Android:
  • Android is a powerful, open source, Linux – based operating system.
  • It provides a rich development environment for building the applications.
  • Android has a higher success ratio, because it reduces the development cost.
  • Android has a large developer community which integrates the internal application.
  • It has reached the top of the smart phone market segment and day by day its user base is growing strong.
  • Android supports audio, video formats like JPEG, PNG, GIF, BMP, MP3, MP4, MIDI, AMR, AMR-WB, MPEG-4 etc.

History of Android

  • Android was developed by the Open Handset Alliance, led by Goggle.
  • The first version of Android was released by Google in 2007 and the Android version 1.0 was released in September 2008.
  • In June 2012, Google announced the next Android version 4.1 Jelly Bean. This version of Android is an incremental update which is mostly used for improving the user interface.
Android VersionDescription
Android 1.6 DonutThis version comes in all shapes and sizes. It allows Android to run on a variety of screen resolutions and aspect ratios.

It has a quick search box that searches the result from the web, from your phone's local content all at once from a single box on the home screen.
Android 2.1 EclairThis version provides Google map navigation. For example, in car navigation system, a forward looking 3D view, voice guidance and traffic information all for free.

It provides customized ring tones, wallpapers and ability to arrange apps (applications) and widgets across multiple screens and in folders. The 'Speech-to-text' is introduced in this version where your spoken words appear straight on your screen.
Android 2.2 FroyoThis version provides voice capabilities which let you perform key functions on your phone like searching, getting directions, making notes, setting alarms and more with just the sound of your voice.

It provides portable Wi-Fi hotspot into your phone where you could stay connected even when on the go.
Android 2.3 GingerbreadThis version provides gaming APIs. It builds rich, graphics-intensive 3D games. This version introduces NFC (Near Field Communication) which supports to transmit the information between devices just by bringing them close together.

This version displays how much battery  of your device has been consumed, allows you to adjust the screen brightness, find out the active applications.
Android 3.0 HoneycombThis version introduces tablet-friendly design with a larger layout pattern. It enhances the experience of reading books, watching videos, exploring maps and more.

It provides a new system bar which is enabled on-screen navigation that controls your Android device. This version gives rights to the user to access essential information  easily like time, date, battery life and connection status of your device all in one place.
Android 4.0 Ice Cream SandwichThis version provides Widgets which embed live app content directly on your home screen that becomes more flexible to customize the home screen.

It manages the network data usage. It tracks how much data you used, set warning levels and hard limits and disable your service if you reach the limit.
Android 4.1 Jelly BeanThis version provides actionable notifications which take action directly from the notification.

It enables multiple users on one device. It provides an account switching feature where each account has its own customized space from the home screen to wallpaper, widgets and apps, so user can share a device and not his/her information.
Android 4.4 KitKatThis version helps to get the things done without touching the mobile screen, just with the sound of your voice – just say “OK Google” to launch voice search, send a text, get directions or even play a song.

It has immersive design which hides everything except what you really want to see.
Android 5.0 LollipopThis version has a bold visual style and the fluid tactile response of Material Design. It makes easier to navigate your device which is based on the shadows and motion.

Using this version, user can move from phone to tablet. It works on all devices, you can pick up where you left off with the songs, apps, photos and even recent searches.
Android 6.0 MarshmallowThis version is the latest android version, which provides last longer battery life and new permissions that give you more control.

Advantages of Android

  • Android is largely supported by Google allowing you to use various services of Google.
  • Android is an open source and runs on mobile devices, tablets etc.
  • It is multitasking that means you can run many applications at the same time. For example, you can browse Facebook while listening the song.
  • The Android operating system is available on mobile phones from various manufacturers like Samsung, Motorola, HTC, Sony Ericsson etc.
  • Using Android phone, you can easily check e-mail from Gmail if your Gmail account is integrated with Google Services.
  • User can easily access a variety of settings quickly and easily.

Disadvantages of Android

  • Android requires continuous Internet connection if you are using Google services.
  • Android shows error & forces to close the large apps/games, which is very annoying.
  • It takes large amount of mobile data if a large number of background processes are running.
  • It increases the usage of RAM and decreases battery performance when many processes are running in the background.

Android Application Components

  • Application components are the essential part of the Android operating system which is used to build the Android applications.
  • The AndroidManifest.xml file describes each component of the application and how they interact.
Following are the Android Application Components,
1. Activities
2. Services
3. Content Providers
4. Broadcast Receivers
5. Intents

1. Activities
  • Activity is also known as Widgets.
  • Activity represents a single screen with a user interface.
  • It is an individual user interface screen in an Android Application where visual elements called Views.
  • It interacts with the user to do only one thing, such as unlock screen, dial a phone, etc.
  • If new activity starts, then previous activity is stopped, but the data is preserved.
  • An application consists of multiple activities.
    For example, an email application has one activity to display a list of new emails, another activity is to compose email, reading email and so on.
2. Services
  • Services performs the action without user interaction in the background, but does not get initiated without user invocation.
  • It does not require a user interface.
  • It is an android application component which runs in a background and has no visual UI.
  • It is used to perform the processing part of your application in the background.
    For example, music player application. When the music station is playing the song, the user can open another application and the song plays in the background.
3. Content Providers
  • Content providers are the android application component that provide a flexible way to make data available across applications.
  • It manages common data based on permissions.
  • It manages the data which is being shared by more than one application.
  • Content provider is a critical concept that has led to develop in-house android applications in a better way.
4. Broadcast Receivers
  • Broadcast receivers are used to receive messages which are broadcast by the Android applications.
    For example, the warning where the battery is getting low, change of time zone, etc.
  • They respond to broadcast messages from other applications.
5. Intent
  • Intent is a message which allows components to request activities from other components.
There are two types of Intents,
1. Explicit Intents
2. Implicit Intents

1. Explicit intents are used for application's internal communications.

2. Implicit intent means sending a message to the Android system to find a suitable activity that can be responded to the intent.