Hey everyone, so far we got ourselves introduced with Android architecture and its four basic components. So why not start developing a “Hello World” Android app? Here it is!

Prerequisites

Well, first things first. Before actually developing an app you need to make sure you meet all the system requirements for developing an Android application , unless you want to be stuck in between. If you are not sure of what are the system requirements you can quickly read this.

Getting Started- Hello World Android App

Now that you have everything to start with just go and click on the Android Studio icon and open it. This will open a dialog on your screen. On the dialog just click on the “Start a new Android Studio project” (look at the screenshot for reference)

This will take you to a new dialog which will already have some pre selected fields.You can change them if you want

Here is the quick info of what these fields mean

Application Name – This is the name of the application you are building Company Domain – This is the name of your company domain . It will be part of your package name. Package Name – This is the name of your package where all of your project files reside. It is expected to be unique

This will take you to a new dialog where you need to specify the target devices for which you are building this application. Most of the fields are preselected and if this is your first app I recommend you not to change any of these to avoid unnecessary confusions. Now click “Next” which takes you to a new dialog(look at screenshot below)

Actually you need to specify the minimum SDK for the device you are targeting. The Minimum SDK will actually decide what APIs will be available to you while developing this app.(Keep it unchanged unless you have any special requirements)

Well, you are almost there. You now need to select the launcher activity of this app.( Not sure of what an Activity is? Read this ) So, basically you are selecting the of what the user will first see on the screen when he is opening this application

Android Studio is really helpful when it comes it these things. It provides you with a bunch of activities to choose from. This contains everything from complex activities like “Map Activity” to simple activities like Empty or Basic Activity. Just selecting one of them will automatically add all the UI and Java code to your project.

For this case, select the “Basic Activity” and click “Next”

Calm down this is your last dialog, and this just has two fields. Basically you just need to specify the file names for your launcher activity you just selected. As I explained here activity is actually a UI component bundled with some functionality. Android actually separates the UI and functional part into two separate files to honour the Model-View-Controller programming strategy. UI design is present in a XML file, XML files are easy design and read plus have a tree like structure making it appropriate for Android UI development .Whereas for the implementing the required functionality we have a separate java file which binds to the UI and performs the required actions

Give the appropriate file names and click “Finish”.

That’s it!. This will create a completely functional “Hello World” Android Application.

Project Structure

Congrats everyone!. We have just created a fully functional Android Application. But you might still be confused seeing all the files/folders in your upper left window(Highlighted in the above screenshot). Well, these are all the files Android Studio created for you to get this application working. Each one of them has its own functionality. Here is a quick intro of all of them

src

This contains the .java source files for your project. By default, it includes a MainActivity.java source file having an activity class that runs when your app is launched using the app icon.

gen

This contains the .R file, a compiler-generated file that references all the resources found in your project. You should not modify this file.

bin

This folder contains the Android package files .apk built by the ADT during the build process and everything else needed to run an Android application.

res/drawable-hdpi

This is a directory for drawable objects that are designed for high-density screens.

res/layout

This is a directory for files that define your app’s user interface.

res/values

This is a directory for other various XML files that contain a collection of resources, such as strings and colours definitions.

AndroidManifest.xml

This is the manifest file which describes the fundamental characteristics of the app and defines each of its components.

Gradle

This contains gradle files which are used while building your android application. They contain information like version name/number, third-party dependencies and repositories