Skip to content

Android basic app

Today I’ll tell you how to start with Android. For the readers who are familiar with basics of Java, it will be easier for them as code is written for Android apps requires Java programming.

Now what do we need for Android programming:

  • Android Studio
  • Internet

The coding in Android apps can be broken into two parts:

  1. The Java code
  2. The XML code

The Java code: Where we define the functionality of the application
The XML code: Where we design the UI of the app.

Let’s start with the famous Hello World program

  1. Start Android Studio and click on Start a new Android Project.
  1. Write the Application Name MyFirstApp and Company name com
  1. Click next and select option Phone and Tablet.

Select the minimum SDK you want. Now selecting the minimum API level helps you decide the lowest Android OS you want your to run on to. For the demo we are selecting API 14.

  1. Click next and select Empty Activity as shown in the screenshot.
  1. Click next and finish. Doing this Android studio will create a basic project with an activity MainActivity (The Java class) and activity_main (The XML file).

Now what is an activity…. OK I’ll give an idea so we can start will our hello world program. Activity is the java class which helps in giving the functionality of the screen in an app and also it combines the functionality with the designing which we do in the XML file. So for example we created a simple button in our XML file the what to do with that button will be defined in our Activity.

Now whenever we create an Android project,  Android studio create itself a hello world program we do not need to create one. But we need to know how to see our demo app in mobile/emulator…… Now what is an emulator???? Many of the users might have used bluestacks or genymotions or some other tools which can run any android app, what are these one can think of them as virtual devices. Emulator is also similar to these it’s provided by Android studio. So in case you don not have a testing device or you want to check you app on an emulator we need to create one. We can create any size, any specific Android version and much more.

So before running our app let’s see how does our app looks

Now we can see our java code it has something written there not understandable write now. But there we see our XML file highlighted press CTRL+Click

Now Android studio shows at the stage of development how our will look in a real device. At the bottom we can see two options Design and Text. Now text tab shows the xml code required for  the design. We can also see the design of the code we write in text tab on the right side it has a preview option. So one doesn’t needs to switch the tabs to see the preview of the UI it can also be seen in preview.

Now lets run our first hello app:

You can see icon on the top or you can click on Run menu> Run app

Now a popup appears it has two options Connected devices and available devices. Connected devices shows the currently connected active devices with your PC. Available devices shows all the emulators created on your PC. By default Android studio creates an emulator itself you can select it or if you have one real device, you cannot it with a cable and it will be shown here.For now lets run the app on an emulator. So select your emulator and click OK it will create an emulator and will take a few minutes in starting it.

Voilà, our first Android app looks great……….

Thanks for reading.

Previous article

Animated Splash Screen to you Android App using Android Studio

Next article

Android: Overdraw, Why Should We Care?

Join the discussion

Leave a Reply

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

%d bloggers like this: