Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There are a lot of android resources types: layouts, strings, drawables and so on. I understand that readability of it's names is important but can not create a table of rules how to name them in the best way.

Are there any best practices on that?

share|improve this question

closed as primarily opinion-based by MichaelT, durron597, enderland, gnat, Ixrec Oct 18 '15 at 18:41

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

I don't think this is a particularly constructive question. I'll monitor the answers to see if anything useful comes out, but it's likely to be closed fairly soon. – ChrisF May 10 '11 at 13:09
up vote 0 down vote accepted

I never came accross an "official" good practice for naming resource. Each type of resource is kinda located in a specific directory (layouts in "res/layout", etc., so I think common sense is enough here.

share|improve this answer

I think a good practice is to name the resources uniting the the activity name (if exists), object type or object name, and property name, using all chars in lower case. I believe that if the resources exists, it'll be used, so I would name my resources like below:

If I have a object used in a Activity:

mainactivity_button_id - using the type of object mainactivity_button_ok_id - using the name of object

If the object isn't been used in a Activity or is used in various locals:


share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.