Work with a lot of Android resources



  • I'm downloading the list of the television channels and their addresses from the server, and every telecanal has a needle. The list of television can change, in drawables, I keep all the icons, about 40.

    How do it be better to organise the icons to the telecalls so that they can be removed?

    In the thoughts: creation of a map of the renal name of the telecanal, reference to the vent resource, then searching the map and making reference to the object of the telecanal.



  • You can get a id resource by name, like that.

    getResources().getIdentifier("my_drawable_name", "drawable", getPackageName())  
    

    This is a more flexible approach. And you don't have to be drunk.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2