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>
    </style>

Referenced in a layout file like this:

<Button
        ...
        android:textAppearance="@style/config_message_style"
        ... />

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.

17 comments:

  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

    ReplyDelete
    Replies
    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 ;)

      Delete
  2. Interesting blog post. This blog shows that you have a great future as a content writer. Waiting for more updates...
    Java Training in Chennai | RPA Training in Chennai

    ReplyDelete
  3. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way. T hank you so much.
    Web Designing Course in chennai
    PHP Training in Chennai
    web designing training
    web designing in chennai
    PHP courses in chennai
    PHP Training Chennai

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. I am really enjoying reading your well written articles.
    It looks like you spend a lot of effort and time on your blog.
    I have bookmarked it and I am looking forward to reading new articles. Keep up the good work..
    Java Training in Bangalore
    Best Java Training Institutes in Bangalore
    Java Course in Bangalore
    Java Training Institutes in Bangalore
    hadoop training in bangalore
    hadoop training in bangalore
    big data training in bangalore

    ReplyDelete
  6. In the beginning, I would like to thank you much about this great post. Its very useful and helpful for anyone looking for tips. I like your writing style and I hope you will keep doing this good working.
    ccna Certification Course in Bangalore
    ccna Certification Training in Bangalore
    Best ccna Coaching Centre in Bangalore
    Angularjs Coaching in Bangalore
    Angularjs Institute in Bangalore
    Best Angularjs Training in Bangalore

    ReplyDelete