Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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

2 Answers 2

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:

global_string_messagetext

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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