I want to press several buttons. For example, you can press button3 after pressing button1 (you cannot press button3 if you do not press button1). I want it to work like the code below, but I don't know how to write it correctly.
public void onClick(View view){
if(view.getId() == R.id.button1){
button1.setBackground(ContextCompat.getDrawable(this, R.drawable.design_btn_red_on));
if(view.getId() == R.id.button3){
//Blink button3
if(view.getId() == R.id.button10){
button3.setBackground(ContextCompat.getDrawable(this, R.drawable.design_btn_default_on));
}
}
}
if(view.getId() == R.id.button2){
button2.setBackground(ContextCompat.getDrawable(this, R.drawable.design_btn_green_on));
}
}
Above code: press button1 to turn button1 red and then press button3 to turn button3 blink. And then press button 10 and button3 turns white.