Android Directory structure

Android folder structure consists hierarchy of the files:

MyfirstProject

  •      src
           com.myfirstproject.activities         
  •  Main.java
  • gen(Generated jave files)
  • Android version
  • assets
  • res drawable-hdpi
    drawable-ldpi
    drawable-mdpi
    layout
    main.xml
    values

Androidmanifest.xml

Let us check the  function of each folder below:

gen

The gen directory in android directory structure contains the autogenerated files. It contains R.java that is automatically generated by eclipse when you craete a new project.

res :

The res directory in android folder structure contains all the resources related to the project. The res folder is used to keep the files like images, xml files separate from the source code.

 

The main difference between res and asset folder is that. The files stored in the res folder can be used to reference from the code. You can add the code to access these files  anywhere within the application, but the files that are stored in the asset folder , you cannot reference it.

R.drawable.id  : This code is used to reference these values. Every resource that  is added in the resource  folder is assigned an id and it can be called using that  id.

res/values :

It is used to define string of values, color , dimensions etc

res/layout :

This folder contains layout to be used in the application.

res/drawable:

This contains many subfolders

res/drawable-hdpi :

this folder stores bitmap for high density. The app automatically takes the images  from the corresponding folder based upon the hardware of  the mobile. So we have to just  place the different density files in the appropriate folders, and the  system automatically  takes it .

res/drawable-mdpi

this folder stores bitmap for medium density

res/drawable-ldpi:

this folder stores bitmap for low density.

asset :

This folder in android folder structure is used to store anything you want to store in the application.

Androidmanifest.xml file :

This  is the main  file,  that  controls all the components of the application. This file is in xml format.

 

Read next part

androidmanifest-xml-file