950 views 1 comment

Android 101 : Day 1 | Building Your First App

by on July 15, 2015
 

Welcome to our Second Tutorial for Android Application Development. Today you will be Building Your First App – a simple “Hello World” Application. But first we will learn how to set up an Android Emulator, Use Dalvik Debug Monitor Service (DDMS) to get list of connected devices, and finally we’ll run our Application on the Connected device. I have already explained how to Set up the  Development environment for Android in our last tutorial. For those who have not yet Set up their Development Environment, are recommended to go through it.
Well, let’s get Started with our today’s tutorial.

What is an Android Emulator ?

The Android SDK provides a Virtual Mobile Device Emulator that you can prototype, test, and develop Android applications without the need for a physical device. But before launching the emulator, you must create an Android Virtual Device (AVD) which defines the system image and device settings used by the emulator.

Setting Up the Android Emulator

Here are the steps to Set up the Android Emulator :
  • In Eclipse, select Window > AVD Manager.
  • Click New
    Android 101 : Day 1 | Building Your First App

    Create new AVD dialog box appears
    Setting up Android Emulator
     
  • Type the name of the AVD, say Mydevice.
  • Choose a target (Platform you want to run on the emulator. It can be either Android API or Google API.)
  •  [Optional] Enter the SD card size, say 400.
  • [Optional] Snapshot :  Enable this to make start up of emulator faster.
  • [Optional] Select required Skin. 
  • [Optional] You can add specific hardware features of the emulated device by clicking the New…button and selecting the feature.
  • Click OK.
  • To launch the Android Emulator, open AVD Manager  > Select Device > Start.
    Setting up Android Emulator
    Launch options dialog box appears
    Setting up Android Emulator
    Click on Launch to launch the Android Emulator.

DDMS Perspective

The DDMS Perspective in Eclipse lets you access all of the features of DDMS from within the Eclipse IDE.

To access the DDMS perspective, go to Window > Open Perspective > DDMS. If DDMS does not appear, go to Window > Open Perspective > Other and select DDMS from the Open Perspective window that appears.

Building Your First App

DDMS perspective shows you the list of Connected devices to your PC on which you can run your application.

Now we are all Set to start Building our First Application…

Creating a New Android Project

  • Open File > New > Android Application ProjectBuilding First Application
    Name Convention for Package Name :
    company.developer.ProjectName or developer.ProjectName
  • Click on Next
     Configure Project
    Building First Application
  • Click Next
    Configure Launcher Icon
    Building First Application
  • Click Next
    Create Activity
    Building First Application
  • Click Next
    Building First Application
  • After Clicking on Finish, Eclipse looks similar to this :

Building first Application

In MainActivity.java, edit the setContentView from activity_main to fragment_main, and the “Hello World” application is ready to run on your Device.
Building Your First App

 

Running The Application

To run your Application :
  • Right click on FirstApp > Run as > Android Application
  • Select your Device on which you want to run your Application.

    Here is the Screenshot of our First Application running successfully .  

    Building Your First Application

So, that’s it for our today’s tutorial. In our next Tutorial, we will design a Simple Toast Applicationand learn about Packages and Layouts in Android.Our next tutorial will be coming out in a few days, keep practicing till then. 😉

NOTE : Our upcoming tutorials might require Rooted Smartphones to run some Applications. For those who want to, can Root your Device with just one click using iRoot.

comments
 
Leave a reply »

 

Leave a Response