Hello World App

Now you are ready to start the development of the application for the Android operating system. Let's boost the motivation for learning Android Programming by developing a hello world app and run it in an emulator and also load it into a physical Android device.

Android Studio Startup Home

Start the Android Studio in your computer system. On the very first time, it will show you a screen having blank left pane which will have the list of projects you will develop in Android Studio. In the right pane, it has a few control buttons like Start a new Project, Open Existing project, Import code sample, etc. Click on the button "Start a new Android Studio Project."

Android Studio Create New Project

Give Application name of your choice. If you have any company domain, type that domain or just go with the default one. The company domain will be used in reverse order as a package location. Click next.

On next screen leave everything to default. We are developing an application for Phone And Tablet, and we are specifying the minimum SDK version required to run this application. Click Next.

Select the Empty Activity from the list of options shown on Add an Activity to Mobile and click Next button. Leave the name of the Activity to default, though you may change it and give a name of your choice, for now, let's keep everything simple. Also, leave the check boxes for backward compatibility and Generate Layout file checked. Click Finish.

Android Studio prepares the environment for the project, download all the default dependency and give you a window to start the development.

By default, it will open two files for the activity we have created. In this case, the files are MainActivity.java and activity_main.xml. For the time being assume that you know these files, we will discuss these later in the series. Open the XML file; it has a user interface showing you a Hello World label in the middle of the screen.

Click the Run button from Shortcut menu bar. Android studio shows you pop windows having a list of available virtual devices and physical Android smartphones with developer mode enabled. If it is showing you nothing, you need to create one Virtual device or connect a physical device.

Android Studio Virutal Device Manager

For now, let's create a new virtual device just by clicking the button Create New Virtual Device. It has a list of devices which are preconfigured based on the physical devices available in the market. Select any of them and click Next.

Select the SDK version you want the device to run. If the SDK is already installed in your Android Studio you may choose it; otherwise, you need to download it, just by clicking the link next to the SDK. The downloading may take some time depending on your internet speed.

Give the device a name. Default names are quite descriptive, and I recommend using the default one, but you may key-in whatever you like. Click Finish.

Now the device is available to test the application, just select the device and process by clicking the button. Depending on your computer system, Android Virtual Device may take some time to boot and launch the application.

If you have connected the Physical Android device with developer mode enabled, you will see the launched application in the physical device with the name you choose in the project creation.

Congratulations, you have successfully developed a Hello world app for Android using Android Studio and Java. Next, we see the life cycle of an Activity.