This tutorial is where we start with understanding the basic concepts of Android. Then we will build a sample app for Android powered mobile devices. If you’re a beginner and want to increase your understanding of Android, then you came to the right place.

What is Android?

Android is an open source software which was introduced by Google. It’s based on a Linux kernel. It’s easy to understand and easy to develop for. Constant updates keep coming with new areas to explore. It has fewer restrictions and hence gives loads of flexibility to a developer. It’s the hottest technology in the market and companies are giving big packages to Android developers. As a “tech enthusiast”, this tutorial is a must for you.

What are Android Applications?

Applications specifically developed to run on your Android powered device(s). As a beginner, let’s start from the basics.


Let’s begin by setting up the basic requirements. Below you can find the list of software which we need beforehand.

  1. Java JDK
  2. Android SDK
  3. Eclipse IDE for Java Developers or Android Studio
  4. Android Development Tools (ADT)

If you’re at a beginner level and haven’t installed the prerequisite software for developing Android apps, follow these steps:

Setup the Java Development Kit (JDK)

Go to the JAVA SE DOWNLOAD website. Follow the instructions given and install the latest JDK.

Then you need to setup the Eclipse IDE or Android Studio.

How to Setup the Android SDK

  1. Go to the  Android SDK Downloads website. Download and install the Android SDK.
  2. Go to All Programs > Android SDK Tools > SDK Manager
  3. Click on install packages
  4. Accept the terms and conditions
  5. Click on next. If you agree to install all the packages, select the Accept All radio button and proceed by clicking the Install button. Download the version on which you want to develop Android applications.
    Screenshot (80)

Create an Android Application from Scratch

As a beginner Android developer, let’s make your first Android Project. You need to click on New Project or New Android Application in Android studio or the Eclipse IDE.

application details

Fill in the required details by following these steps:

  1. Application Name is the app name that appears to users. For this project, use “My First App.”
  2. Project Name is the name of your project directory and the name visible in the IDE you’re using.
  3. Package Name is the package namespace for your app (following the same rules as packages in the Java programming language).
  4. Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level.
  5. Target SDK indicates the highest version of Android (also using the API level) with which you can run/test with your application.
  6. Compile With is the platform version against which you will compile your app. By default, this is set to the latest version of Android available in your SDK.
  7. Theme specifies the Android UI style to apply for your app.
  8. Use the next screen to configure the project. Leave the default selections and click Next.
  9. The next screen can help you create a launcher icon for your app. You can put a custom icon or you can change the default icon with the basic formatting provided. image10
  10. Click on Next to proceed.
  11. Now you can select an activity template from which to begin building your app. For this project, select BlankActivity and click Next.
  12. Leave all the details for the activity in their default state and click Finish.

Know your application folder

Before you run your app, you should be aware of a few directories and files in the Android project:

Screenshot (65)W

What is AndroidManifest.xml?

The manifest file describes the fundamental characteristics of the app and defines each of its components. All the permissions required by an application are declared here. One of the most important elements your manifest should include is the <uses-sdk> element. This declares your app’s compatibility with different Android versions using the android:minSdkVersion AND android:targetSdkVersion attributes. For your first app, it should look like this:

Screenshot (66)

  • You should always set the android:targetSdkVersion as high as possible and test your app on the corresponding platform version. For more information, read Supporting Different Platform Versions.
  • src/ Directory for your app’s main source files. By default, it includes an activity class that runs when your app is launched using the app.
  • icon.res/ Contains several sub-directories for app resources. Here are just a few: drawable-hdpi/ Directory for drawable objects (such as bitmaps) that are designed for high-density (hdpi) screens. Other drawable directories contain assets designed for other screen densities.
  • layout/ Directory for files that define your app’s user interface.
  • values/ Directory for other various XML files that contain a collection of resources, such as string and color.

If you have a real Android powered device, here’s how you can install and run your app:

  1. Plug in your device using a USB cable.
  2. Enable USB debugging on your Phone.
  3. To run the application from Eclipse:
  4. Open any project’s files and click Run from the menu.
  5. In the Run As, select Android Application and click OK.
  6. Eclipse will install the app on your mobile and start it.



  1. To run your application on an emulator, first we need to create one.
    To create an AVD:

    • Click Android Virtual Device Manager from the toolbar.
    • In the Android Virtual Device Manager panel, click New.
    • Fill in the details for the AVD. Add a name, a platform target, the SD card size, and a skin according to your needs.
    • Click Create AVD.
  2. Select the new AVD from the Android Virtual Device Manager and click Start.
  3. After the emulator starts, unlock the emulator screen.
  4. To Run The Application From Eclipse:
    • Open one of your project’s files and click Run from the toolbar.
    • In the Run As window that appears, select Android Application
    • Eclipse installs the app on your AVD and starts it.

Creating a Linear Layout for your application

Open the activity_main.xml file from the res/layout/ directory and copy paste the code below over the existing one.
Snippet 1:

  • In a Linear Layout, all child views in either a vertical or horizontal orientation are controlled by android:orientation attribute. Unlike a Relative Layout, each child of appears in the order in the XML.
  •  android:layout_width and android:layout_height. These are required in order to set the size of a view. To fill the entire screen area we put “match parent” as their value.

How to Add an Edit Text inside an Android activity

To add a user-editable text field, use a <EditText>.

Snippet 2:

How to Add a String inside your application

  1. If you are using predefined strings, it’s a good habit to initialise them as a resource.
  2. Go to res/values/strings.xml. Add a new string named “edit_message” and set the value to “Enter a message.”
  3. The result for strings.xml looks like this:

How to Add A Button in you app

  1. Add a <Button> after the  <EditText> element:
  2. The height and width this time will be “wrap_content” so that the button only bounds an area required by it.
  3. weight property will help in using the unused spaced efficiently.
  4. onClick property will be used to call the function in the java file where this activity is included.
    Snippet 4: 

Listing 1 :

Working on the JAVA file

  1. Go to src/
  2. Open the MainActivity class and add the code below. If any error shows, import the required classes.

Snippet 6:

Take care as the name should be exactly the same as given in the XML file. Specifically, the method must:

  • be public
  • return void
  • have a View as the only parameter

What are Intents

  1. The Intent represents an app’s “intent to do something.” You can use intents for a a number of things from activity change to sms sending. It can carry a bundle of data with it too.
  2. Inside the sendMessage() method, create an intent to start an activity called ViewMessageActivity.
  3. We use findViewById() to get the EditText element so to add its text to the intent.

Snippet 7:


  • An intent can carry a collection data types. The putExtra() method takes the name in the first parameter and the value in the second parameter.

Snippet 8:

The First Activity for an Intent based application

Listing 2:

Working on the second activity

  1. Create the Second Activity with the name ViewMessgaeActivity
  2. To create the new activity
    • Left click on src/package
    • New > Others > Android > Android activity.
    • Now fill the details as done before.
    • Click Finish.
      Screenshot (68)

Listing 3:

Add it to the manifest

    • All activities must be declared in your manifest file AndroidManifest.xml, using an <activity> element. This will be done automatically if you followed the above steps to create an activity.

Snippet 9:

Receive the Intent

  • To get the data passed by the calling activity we will use the getintent() method.

 Snippet 10:

The complete onCreate() method for ViewMessageActivity now looks like this:

Listing 3:

Run this code as an android application:

Screenshot (70)

Add an image to your application.

Adding image files to the project

    • Put your images into folder “res/drawable-ldpi“, “res/drawable-mdpi” or “res/drawable-hdpi“. You can just create your own drawable folder and not get into image density

Screenshot (72)

  • These folders are divided according to the density of the image file.

Below are the two files that we have included in our project in .png format:





Adding the image file to your screen.

  1. Go to your xml file activity_view_message.
  2. Go to the palette menu > images & media > imageview.
  3. Drag and drop the imageview option onto your activity screen.
  4. From the image options select androids.pngScreenshot (74)
  5. Also add a button below the image and name it change image.
  6. Or copy/paste the code below to your xml file:
    Listing 4:

To change the image onClick:

  1. Go to the ViewMessageActivity.
  2. Add the code below to change the image onClick.

Snippet 11:

Here we we have used setImageResource(). This is used to manipulate the image resource. Refer to android buttons and click events to learn more.


A toast is a messgae in a small popup. It does not take the whole space or stop the thread of the main activity. Toasts automatically disappear after a set time. You can set the time as needed.
To add a Toast, add the code below and import the required files.
Snippet 12:

So finally our ViewMessageActivity should look like this.

Listing 5:

So After changes Our Activity should work like.

Screenshot (77)


From the above tutorial, we have developed a basic Android application and learned the basics of an Android development for beginners. If you have any suggestions or get any error while implementing this procedure, feel free to comment below.