0 of 5 lessons complete (0%)
Exit Course

Lesson 4

You don’t have access to this lesson
Please register or sign in to access the course content.

Understanding The IDE interface.

The following installation level should include selecting the activity to mobile, which specifies the default layout for Applications.

Sr.No. 	Folder, File & Description


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


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


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


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


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


This is an auto generated file which contains compileSdkVersion, buildToolsVersion, applicationId, minSdkVersion, targetSdkVersion, versionCode and versionName.

The Main Activity Record

The main activity code is contained in the Java file MainActivity.java. This is the application file that is eventually converted to a Dalvik executable and runs your application. The following is the Hello World! application wizard’s default code. the application.

package com.example.helloworld;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
   protected void onCreate(Bundle savedInstanceState) {

R.layout.activity main refers to the file activity main.xml in the res/layout folder. When an activity is loaded, the onCreate() method is one of many that are figured.
The Manifest Document

Whatever component you create as part of your application must be declared in a manifest.xml file located at the root of the application project directory. This file serves as an interface between the Android OS and your application; therefore, if you do not declare your component in this file, the OS will not consider it. A default manifest file, for example, will look like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

      <activity android:name=".MainActivity">
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />

Here… tags enclose the application-related components. The android:icon attribute will point to the application icon found in res/drawable-hdpi. The application makes use of the image ic launcher.png, which is located in the drawable folders.

The tag is used to specify an activity, and the android:name attribute specifies the fully qualified class name of the Activity subclass, as well as a string to use as the activity’s label. Tags can be used to specify multiple activities.

The intent filter action is named android.intent.action.

MAIN to indicate that this activity serves as the application’s entry point. Android.intent.category is the category for the intent-filter. To indicate that the application can be launched from the device’s launcher icon, use LAUNCHER.

The @string attribute refers to the strings.xml file.

as explained below As a result, @string/app name refers to the “HelloWorld” app name string defined in the strings.xml file. Other strings are populated in the application in a similar manner.

The tags listed below will be used in your manifest file to specify various Android application components.

components for activities

service components

broadcast receiver components

content providers’ elements

The Strings Directory

The strings.xml file is in the res/values folder and contains all of the text used by your application. This file contains strings such as the names of buttons, labels, default text, and other similar data. This file is in charge of their textual content. A default strings file, for example, will look like this:

   <string name="app_name">HelloWorld</string>
   <string name="hello_world">Hello world!</string>
   <string name="menu_settings">Settings</string>
   <string name="title_activity_main">MainActivity</string>

The Layout Document

The activity main.xml layout file is located in the res/layout directory and is used by your application when building its interface. This file will be changed frequently to change the layout of your application. This file will contain the following content related to the default layout for your “Hello World!” application.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_height="match_parent" >
      tools:context=".MainActivity" />

This is an example of a simple RelativeLayout, which will be covered in a later chapter. The TextView is an Android control that is used to build the GUI. It has attributes such as android:layout width, android:layout height, and others that are used to set its width and height. The @string specifies the strings.xml file in the res/values folder. As a result, @string/hello world refers to the “Hello World!” string defined in the strings.xml file.

Starting the Application

Let’s try running our new Hello World! application. I’m assuming you created your AVD while configuring your environment. To run the app from Android Studio, open one of your project’s activity files and select the Run Eclipse Run Icon tool bar icon. Android Studio installs and launches the app on your AVD, and if everything is in order with your setup and application, it will display the Emulator window shown below.

Congratulations!!! you have developed your first Android Application and now just keep following rest of the tutorial step by step to become a great Android Developer. All the very best.

Free Digital Marketing Course.

Includes Branding,SEO Concepts.