android - Toggling View background -


i have view object on activity , i'd change background resource of view. more specifically, i'd toggle it.

so i'll need logic this:

if (myview.getbackgroundresource() == r.drawable.first) {   myview.setbackgroundresource(r.drawable.second); } else {   myview.setbackgroundresource(r.drawable.first); } 

the issue here being there no getbackgroundresource() method.

how can obtain resource view using background?

i don't think view remembers resource using after gets drawable resource.

why not use instance variable in activity, or subclass view , add instance variable it?


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -