I am making an Android Calculator App. I want to delete an input instead of clearing the whole value. This is code for adding values
private void updateText(String value) {
output = output value;
display.setText(output);
}
How can I delete a single value using the delete button?strong text
CodePudding user response:
Try this
private String removeLastChar(@NonNull String value){
return value.substring(0,value.length()-1);
}
Note: Input value must non-null. So check before passing