The First Button Only Will Be Coloured Permanently After Reopen Application
I have multiple buttons and I want the button become colour after clicked and reopen again the button is that colour permanently and I want do like when user click on button4, the
Solution 1:
Here is the deal:
b[0].setBackgroundColor(getColor())
Just replace 0
with i
:
b[i].setBackgroundColor(getColor())
UPDATE: The better way to store index of the last selected button. So instead of color, store button index. That's how you will now which button was selected after app reopen.
Solution 2:
Just store the last click index in SharedPreferences;Reopen application check the index and colour the index button.
Post a Comment for "The First Button Only Will Be Coloured Permanently After Reopen Application"