Standard application development for Android

Android developer is faced with large numbers of files and resources designed for different parts of the program.Even after a month he can not remember which file or resource to which belongs. 


Material presented below is based on my experience of many development projects for Android and has been tested in several projects. As a result, simple rules pile of files and resources into a readable project, saves time and nerves. Especially when it is convenient to work in a team where the project can join the new programmers.In Eclipse, you can easily find any resources because they are unique, easy-to-find and understandable manner are sorted in any lists. General rules allow convenient easy to read someone else's code and find the necessary resources. Most of these are my personal opinion.
Standard application development Android


The names of all files


The file name is written in small letters, reflect the human-readable name of the element, perhaps a few words.Gap is replaced by an underscore.

Location of user files on an SD card


The root directory for all user files, except for time:
/ Sdcard / project name / example / sdcard / TalentMania /

Catalog for music:
/ Sdcard / project name / sound /, eg / sdcard / TalentMania / sound /
Directory for MIDI:
/ Sdcard / project name / midi /, eg / sdcard / TalentMania / midi /
The directory for graphics:
/ Sdcard / project name / img /, eg / sdcard / TalentMania / img /

Subdirectories for files of various aktiviti:
/ Sdcard / project name / img / title aktiviti / example / sdcard / TalentMania / img / guitar /

Location of temporary files - use the standard functions of a class File:
createTempFile (String prefix, String suffix, File directory)
Creates an empty temporary file in the given directory using the given prefix and suffix as part of the file name.
createTempFile (String prefix, String suffix)
Creates an empty temporary file using the given prefix and suffix as part of the file name.

Location of files in the application resources

The graphics and sounds for use in assetsah (eg library AndEngine) are grouped into the following directories:
MIDI files - assets / midi /
The graphics for sprites - assets / gfx /
TTF fonts - assets / font /
Common files used by different activity are placed in the root. Files used by only one activity are placed in the subdirectory, for example: assets / gfx / guitar /

MP3 files are placed in the directory res / raw /.

Names Icons

In the names of icons prefix describing the type of

Icons ic_ Example: ic_star.png
Will start ic_launcher_ Example: ic_launcher_calendar.png
The icons ic_menu_ Example: ic_menu_archive.png
Status bar icon ic_stat_sys_ or ic_stat_notify_ Example: ic_stat_notify_msg.png
Icons tab ic_tab_ Example: ic_tab_recent.png
Icons dialogue ic_dialog_ Example: ic_dialog_info.png

Buttons

bt_imya_pressed.png (click image) and bt_imya_default.png (default image)
xml describing the animation is stored in drawable! - bt_imya.xml

Layouts

main leyauty correspond to names of callers aktiviti.
ac_nazvanie_klassa.xml - matches the name of the class aktiviti AcNazvanieKlassa.java.

Additional view for this leyauta correspond to names of callers aktiviti + nameac_название_класса_название_view_название.xml view

view_nazvanie_view.xml - general view for different leyautov.
adt_nazvanie_adaptera.xml - leyauta name for the adapter list
dialog_nazvanie_dialoga.xml - the name of dialogue

Names of elements in the layout

Name of the element used in the layout -

For example: android: id = "@ + id / AcMenuTemplateTopPanel" indicates that the element is called "top panel" and is intended for aktiviti AcMenuTemplate

Animation

definition files are stored in the animation res / drawable.
For buttons - bt_imya_anim.png
For animation - anim_имя_активити_имя_анимации.png
If a lot of animation, it is more convenient to place it in a separate directory res / anim

Graphics

Background - bg_orientatsiya_imya.png.
Image - im_imya.png

Name of Package

Aktiviti - activities
Adapters - adapters
Data - data
Dialogs - dialogs
Interfaces - interfaces
Types - views

Name class

Aktiviti - AcNazvanieAktiviti
Adapters for lists - AdtNazvanieAdaptera
Dialogs - DialogNazvanieDialoga
Interface NazvanieInterfeysaInterface

Result

The proposed standard is not a dogma, and always subject to change with the accumulation of empirical experience. I hope to hear feedback and suggestions on this topic. It is interesting to know the experience of other developers.