Search code examples
androidandroid-resources

Android Too many ID


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


Solution

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