I am developing a simple calculator using Android Studio.
I have built many buttons that emulate the real keys.
I have set a number for each button.
When hitting the button, can get the text from the button pressed as well as print it to the display area where all numbers will appear.
Everything works well except for the fact that a space appears between numbers when being displayed as shown in the emulator.
What can I do ?
static void getSetText (Button button) {
String input;
button.setOnClickListener (new View.OnClickListener() {
@Override
public void onClick (View v) {
Button b = (Button) v;
buttText = b.getText().toString();
if (init) {
display.setText ("");
init = false;
}
display.setText (display.getText() + buttText);
}
});
}
EMULATOR:
