All CategoriesAndroid App Development

Building Your First Android Application

In this blog, we will guide you to build Android application using Android Studio IDE. Before you go ahead and start building your app make sure that you have downloaded and installed the Integrated Development Environment (IDE) Android Studio.
Now, let’s begin to build a new Android project. Perform the following steps to build Android application.

  1. Creating a New Project.                                                                                                                                                             a.If you are creating an Android project for the first time then click “Start a new Android Studi Studio Project” in the Welcome to Android Studio window.


Figure 1: Welcome to Android Studio window
b. If you already have an existing android project then click “Open an Existing Android Studio Project”.
Note – If you have project opened then File_>New Project.

Figure 2: Creating a New Project from Project Structure
Once you click on New Project, Create Android Project window will be displayed.
c.Fill in the following credentials to successfully create an Android Project:

  • Application name – User can enter the application name of their choice. For example “My Application” or “My First App”.
  • Company domain – User can give their domain name as the company domain name. But for the learning process, user can use “example.com”.
  • Project location – User can give the location of the project file of their choice.
  • Include C++ support – If user wants C++ support, check the “Include C++ support” in your app else click on Next.
  • Package Name – After entering all the details android studio construct a unique package name. For example, the package name in the below example is acadgild.com.myapplication.


Figure 3:  A Pop-Up window to create a new Project
2. In the Target Android Devices window, user have a privilege to add the target API levels of mobile and tablet versions.
In other words, you can restrict your application to work only on the targeted devices whose API level is greater than or equal to specified target API level.  Click on Next.

Figure 4: Target Android Devices Window
3. In Add an Activity to Mobile window, user can select the activity which you want to use in your application. But for the learning process, we strongly recommend you to work in the Empty activity.

Figure 5: Add an Activity to Mobile in Create New Project Window
4. After clicking next Configure Activity Window will appear and just click on finish.

  • In this window the Android Studio will automatically write the name of your name activity and also construct it’s layout file.
  • You can also give any other name to you activity.


Figure 6: Configure Activity
5. After processing, the Studio will open the Integrated Development Environment (IDE) with pre-written code.

6. Now, let’s proceed further and take you to the layout file where you can edit the user interface of an Application.

Figure 8: Activity_main.xml file overview
a. Click on res folder and then just open the activity_main.xml file and edit the text from “Hello World” to “My First Application” at line number 12 mentioned in the above screenshot.
7. Now, open your MainActivity.java file and try to change the color of the text that you have written.
a. Make the necessary changes inside MainActivity.java file as shown in the below attached screenshot.

8. At last, run your Android applications in the Android Virtual device. To run the application, Go to the toolbar in the android studio and click on Run button.

Figure 10: Showing Run button on the Task bar
9. After clicking on Run button, a popup window will appear which allows you to create an Android Virtual Device.

Figure 11:  Creating a New Virtual Device on Deployment Target Window
Select the phone specification on which you want to run your app.

  • Here you can select any virtual device from the list and proceed.
  • After selecting the device name, you can select the appropriate API level which you want.


Figure 12:  Select Hardware in Virtual Device Configuration Window
10. Now, select the API Level which you want to use in the Virtual Device.

Figure 13: Set the API Level in Virtual Device Configuration Window
11. Now just click on finish and after that you can see a created device in the list of available device.

Figure 14: Customize Your Android Virtual Device
12. Click Ok. The device which you created starts running your Android application. After some time, AVD also starts and it will run the application.

Figure 15: Creating New Virtual Device

Figure 16:  AVD Screenshot after application launch
Hope this blog has clearly explained how to build your first Android Application. To know more information on Android User Interface, you can read Android UI: Understanding Views and View Groups Blog.
 
 

Tags

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Close