1

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?

1
  • 1
    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, 2011 at 13:09

2 Answers 2

0

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.

-1

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

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