0

I'm building an Android app and I begin to have too many Id resources.

I wondered if there would be a way to have for example

TextView text = (TextView) findViewById(R.id.activity_name.item)

Thank you

1 Answers1

2

This is not possible to my knowledge as the R class is generated and should not be edited.

But I think you can do the next best thing and make your naming convention match that format with underscores.

for example for all of your id's on the main page, this could be the text on a list element. MainPage_List_Text

Here is another so page you might find useful. Are there conventions on how to name resources?

Community
  • 1
  • 1
Krum110487
  • 611
  • 1
  • 7
  • 20
  • Thank you for this fast answer. So as you suggested, I should (to make à difference between the activities make R.id.activity_name_widget_item – Herel Adrastel Apr 26 '16 at 18:20
  • correct, it is really your preference, but generally you want to order from broad to specific so they group naturally. How you do it is really up to your preference, but 3 pieces of info is normally specific enough, Page_View_PartOfThatView. – Krum110487 Apr 26 '16 at 18:23