I'm wondering how to refresh an activity. Not like restart it, but refresh it. What is happening is I have it so a button lights up, and after it is clicked it waits 5 seconds then resets the buttons and has another one light up, the only problem is the other buttons are not lighting up, as it stays stuck on the same button. I don't know if this is a problem with the code, or I'm not calling a refresh, etc. Any help is good! Thanks.
if(selected == target) {
Toast.makeText(getApplicationContext(), "Good job!", Toast.LENGTH_SHORT).show();
view.getBackground().setColorFilter(Color.GREEN, PorterDuff.Mode.MULTIPLY);
} else {
Toast.makeText(getApplicationContext(), "Wrong!", Toast.LENGTH_SHORT).show();
view.getBackground().setColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY);
}
h.postDelayed(task, millisDelay);
then my task is this:
private Runnable task = new Runnable() {
public void run() {
ResetButtons();
int rnd = new Random().nextInt(buttons.length);
i = rnd;
buttons[i].getBackground().setColorFilter(Color.YELLOW, PorterDuff.Mode.MULTIPLY);
}
};