I have an app that lets you click buttons to add and subtract +5 or -5 and +1 or -1 from a starting value of 20. I have it set up so that when a button is clicked it will put that value into a string and display it so that the user can see a history of what they have pressed. I have a method called reset(); that resets the starting value back to 20, I would like to know how to also clear the string values
add5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
counter += 5;
updateDisplay();
// add the click history for p1
String tmText = (String) btnPressedTV.getText();
btnPressedTV.setText(tmText + "\n" + String.valueOf(counter));
}
});
sub5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
counter -= 5;
updateDisplay();
// add the click history for p1
String tmText = (String) btnPressedTV.getText();
btnPressedTV.setText(tmText + "\n" + String.valueOf(counter));
}
});
void reset() {
// TODO Auto-generated method stub
counter = 20;
display.setText(String.valueOf(20));
display.setTextColor(Color.BLACK);
tmText = "";
}