Important Anatomy of an Android App

Before you run your app, you should be aware of a few some important directories and files in the Android project as follows:




Name
Description
1. Manifest.xml
This is a main file, that describes the fundamental characteristics of the application project

2. Java
This contains the .java source files for your project. By default, it includes an MainActivity.java source file

3. drawable
This contains all .png images that included in your project

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

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

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


 Following are important brief overview of the important above files:

The Manifest File

This file resides at the root of the application project directory. This file works as an interface between Android OS and your application, then it will not be considered by the OS. For example, a default manifest file :-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.exam.myworld.hello">
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
     
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>


Main  Activity File

This is a Java file MainActivity.java. Following is the default generated source code of application wizard for Hello World! application :-

package com.myworld.hello;

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

public class MainActivity extends AppCompatActivity {
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
   }
}










Share this

Related Posts

Previous
Next Post »