Saturday, 18 November 2017

Resource Mirror

Have you ever been in a situation where you had to access android Resources (strings, colours, drawables, etc.) based on their names (for example if the names are stored in a DB, or come from an API) and you had to write long lookup tables converting the names into R.XXXX.ids? And maintaining them?

This library is offering a way around it by using reflection to access the Resource directly by name.

  • You only need to include them as normal into your Res folder tree.
  • It uses LRU caching to mitigate the reflection time overhead.
  • It also includes a few convenience functions to help change Drawable colour based on a hex colour value.



from The Android Arsenal

No comments:

Post a Comment