Issue
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
Solution
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
Answered By - Gobu CSG
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.