Android Tutorial
Android tutorial or android development tutorial covers basic and advanced concepts of android technology. Our
android tutorial is developed for beginners and professionals.
Android is a complete set of software for mobile devices such as tablet computers, notebooks, smartphones,
electronic book readers, set-top boxes etc.
It contains a linux-based Operating System, middleware and key mobile applications.
It can be thought of as a mobile operating system. But it is not limited to mobile only. It is currently used in various
devices such as mobiles, tablets, televisions etc.
What is Android
Before learning all topics of android, it is required to know what is android.
Android is a software package and linux based operating system for mobile devices such as tablet computers and
smartphones.
It is developed by Google and later the OHA (Open Handset Alliance). Java language is mainly used to write the
android code even though other languages can be used.
The goal of android project is to create a successful real-world product that improves the mobile experience for end
users.
There are many code names of android such as Lollipop, Kitkat, Jelly Bean, Ice cream Sandwich, Froyo, Ecliar, Donut
etc which is covered in next page.
What is Open Handset Alliance (OHA)
It's a consortium of 84 companies such as google, samsung, AKM, synaptics, KDDI, Garmin, Teleca, Ebay, Intel etc.
It was established on 5th November, 2007, led by Google. It is committed to advance open standards, provide
services and deploy handsets using the Android Plateform.
Android Architecture
android architecture or Android software stack is categorized into five parts:
1. linux kernel
2. native libraries (middleware),
3. Android Runtime
4. Application Framework
5. Applications
Let's see the android architecture first.
Android Emulator
Android Emulator is used to run, debug and test the android application. If you don't have the real device, it can
be the best way to run, debug and test the application.
It uses an open source processor emulator technology called QEMU.
The emulator tool enables you to start the emulator from the command line. You need to write:
emulator -avd <AVD NAME>
In case of Eclipse IDE, you can create AVD by Window menu > AVD Manager > New.
In the given image, you can see the android emulator, it displays the output of the hello android example.
Next TopicInstalling Softwares For Android
Install Android
Android supports java, c++, c# etc. language to develop android applications. Java is the officially supported
language for android. All the android examples of this site is developed using Java language and Eclipse IDE.
Here, we are going to tell you, the required softwares to develop android applications using Eclipse IDE.
There are two ways to install android.
1. By ADT Bundle
2. By Setup Eclipse Manually
1) By Android Studio
It is the simplest technique to install required software for android application. It includes:
o Eclipse IDE
o Android SDK
o Eclipse Plugin
Click me to download android adt bundle
If you download the Android Studio from android site, you don't need to have eclipse IDE, android SDK and eclipse
Plugin because it is already included in Android Studio.
If you have downloaded the Android Studio, unjar it, go to eclipse IDE and start the eclipse by clicking on the eclipse
icon. You don't need to do any extra steps here.
2) By set up eclipse manually
Visit the next page to learn about setting up android in eclipse manually.
How to setup Android for Eclipse IDE
In this page, you will learn what softwares are required for running an android application on eclipse IDE. Here, you
will be able to learn how to install the android SDK and ADT plugin for Eclipse IDE. Let's see the list of software
required to setup android for eclipse IDE manually.
1. Install the JDK
2. Download and install the Eclipse for developing android application
3. Download and Install the android SDK
4. Intall the ADT plugin for eclipse
5. Configure the ADT plugin
6. Create the AVD
7. Create the hello android application
1) Install the Java Development Kit (JDK)
For creating android application, JDK must be installed if you are developing the android application with Java
language. download the JDK
2) Download and install the Eclipse IDE
For developing the android application using eclipse IDE, you need to install the Eclipse. you can download it from
this location download the Eclipse. Eclipse classic version is recommended but we are using the Eclipse IDE for
JavaEE Developers.
3) Download and install the android SDK
First of all, download the android SDK. In this example we have installed the android SDK for windows (.exe
version).
Now double click on the exe file, it will be installed. I am using the android 2.2 version here.
4) Download the ADT plugin for eclipse
ADT (Android Development Tools) is required for developing the android application in the eclipse IDE. It is the
plugin for Eclipse IDE that is designed to provide the integrated environment.
For downloading the ADT, you need to follow these steps:
1) Start the eclipse IDE, then select Help > Install new software...
2) In the work with combo box, write [Link]
3) select the checkbox next to Developer Tools and click next
4) You will see, a list of tools to be downloaded here, click next
5) click finish
6) After completing the installation, restart the eclipse IDE
5) Configuring the ADT plugin
After the installing ADT plugin, now tell the eclipse IDE for your android SDK location. To do so:
1. Select the Window menu > preferences
2. Now select the android from the left panel. Here you may see a dialog box asking if you want to send the
statistics to the google. Click proceed.
3. Click on the browse button and locate your SDK directory e.g. my SDK location is C:\Program Files\Android\
android-sdk .
4. Click the apply button then OK.
6) Create an Android Virtual Device (AVD)
For running the android application in the Android Emulator, you need to create and AVD. For creating the AVD:
1. Select the Window menu > AVD Manager
2. Click on the new button, to create the AVD
3. Now a dialog appears, write the AVD name e.g. myavd. Now choose the target android version e.g.
android2.2.
4. click the create AVD
How to make android apps
In this page, you will know how to create the simple hello android application. We are creating the simple example
of android using the Eclipse IDE. For creating the simple example:
1. Create the new android project
2. Write the message (optional)
3. Run the android application
Hello Android Example
You need to follow the 3 steps mentioned above for creating the Hello android application.
1) Create the New Android project
For creating the new android studio project:
1) Select Start a new Android Studio project
2) Provide the following information: Application name, Company domain, Project location and Package name of
application and click next.
3) Select the API level of application and click next.
4) Select the Activity type (Empty Activity).
5) Provide the Activity Name and click finish.
After finishing the Activity configuration, Android Studio auto generates the activity class and other required
configuration files.
Now an android project has been created. You can explore the android project and see the simple program, it looks
like this:
2) Write the message
File: activity_main.xml
Android studio auto generates code for activity_main.xml file. You may edit this file according to your requirement.
1. <?xml version="1.0" encoding="utf-8"?>
2. <[Link] xmlns:android="[Link]
3. xmlns:app="[Link]
4. xmlns:tools="[Link]
5. android:layout_width="match_parent"
6. android:layout_height="match_parent"
7. tools:context="[Link]">
8.
9. <TextView
10. android:layout_width="wrap_content"
11. android:layout_height="wrap_content"
12. android:text="Hello Android!"
13. app:layout_constraintBottom_toBottomOf="parent"
14. app:layout_constraintLeft_toLeftOf="parent"
15. app:layout_constraintRight_toRightOf="parent"
16. app:layout_constraintTop_toTopOf="parent" />
17.
18. </[Link]>
19. }
File: [Link]
1. package [Link];
2.
3. import [Link];
4. import [Link];
5.
6. public class MainActivity extends AppCompatActivity {
7. @Override
8. protected void onCreate(Bundle savedInstanceState) {
9. [Link](savedInstanceState);
10. setContentView([Link].activity_main);
11. }
12. }
To understand the first android application, visit the next page (internal details of hello android example).
3) Run the android application
To run the android application, click the run icon on the toolbar or simply press Shift + F10.
The android emulator might take 2 or 3 minutes to boot. So please have patience. After booting the emulator, the
android studio installs the application and launches the activity. You will see something like this: