In one of my activities I have an ImageButton that on click changes the background resource by using setBackgroundResource(). I works fine in that activity but when I leave that activity and come back to it the button has changed back to its default background that was set in the XML. Is there a way to permanently set the background resource to something until the button is clicked again?
In one of my activities I have an ImageButton that on click changes the
Share
You need to store the value on the image button in a static variable or SharedPreferences,
For example declare a variable
now on the img button click
and also do the following in onResume() of the activity: