I have just started android studio, i am stuck on EditText that has to take two numbers as input from user. Basically it is used for a 7-segment display with two digits that is made by views. i am able to turn on the first digit when user enters the first number, but i don't know how to turn on the second digit when user enters second number in EditText.
below is the MainActivity.java code that i've tried.
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start,
int count, int after) {
}
public void onTextChanged(CharSequence s, int start,
int before, int count) {
String input = txtInput.getText().toString();
//below code is for when user enter 1, the 7-segment will turn 1
if (txtInput.getText().toString().equals("1")) {
view1.setBackgroundColor(Color.WHITE);
view2.setBackgroundColor(Color.RED);
view3.setBackgroundColor(Color.RED);
view4.setBackgroundColor(Color.WHITE);
view5.setBackgroundColor(Color.WHITE);
view6.setBackgroundColor(Color.WHITE);
view7.setBackgroundColor(Color.WHITE);
}
the first digit turned red as the user entered 1, how to apply this on second digit aswell