Tuesday, December 30, 2014

Android project, first things first : project files structure

When creating a new android project, a lot of files are generated and appears in our source tree view. Let's a look at what's inside.

Note: The content of java folder will be ignored here.

"XML is your ally"

Hope you like it beacuse XML is used almost everywhere ! Here is a quick description of all of them:

Info file

Defines the Application's main properties : minWidth, minHeight, initialLayout...

Manifest file

There are a lot of similitudes between the manifest file and a C# Assembly. It contains all information about application rights, package name, managed Intents, main components of the application (Activity, Receivers, ...)...
This file will require modifications during development.

Layout file

Graphical definition of an Activity/AppWidget. Most of the time, you will use the graphical interface to edit your screens but a bit of knowledge on layout files can be useful.

Resource files

These files contains user-defined strings, images, style sheets, dimensions... that can be accessed with an id.

<style name="config_message_style">
        <item name="android:textColor">#ccffffff</item>
        <item name="android:textStyle">bold</item>
        <item name="android:layout_width">35dip</item>
        <item name="android:singleLine">false</item>

Referenced in a layout file like this:

        ... />

All of those files are related to each other :

Why several folders with "same" names ?

The drawable folders contain images only with different resolutions (densities) in order to have a good rendering on all kind of devices (tablets, mobile phones, ...).

drawable - hdpi: ~240dpi
drawable - mdpi: ~160dpi
drawable - nodpi: ~160dpi (?)
drawable - xhdpi:~320dpi
drawable - xxhdpi:~480dpi

value-vXX indicates the values that should be used for Android API XX and higher.


  1. You are doing a great job. You inspire me to write for other. Thank you very much. I would like to appreciate your work for good accuracy and got informative knowledge from here.Android Training in Bangalore

    1. Thank you ! I did these posts about Android a few years ago and I hope they are still accurate. Unfortunately, I lacked time to complete the project so I can't hardly give you more information on Android development from this blog but there are plenty on the internet ;)