I have three backgrounds, say for the activity. The displayed background will depend on the code. Aside from using switch/if, is there another way I can pull this off.
I’m thinking of having a static HashMap<Integer, Integer>. The second parameter is for the drawable, so I’ll just use something like map.get(key) to get the drawable.
My only concern for this is performance, will storing the drawable in a key-palue pair HashMap and retrieving the value via map.get(key) affects the performance? Is it an expensive thing to do?
Thanks.
You should be fine. I doubt that any performance hit you do take (if any) will be noticeable to the human eye