Вопрос

I am trying to build an on screen keyboard, for a simple counter application, that adds some points for 2 diffeent teams in 2 columns.

enter image description here

The design thing is pretty simple, but it seems hard for me to programm the buttons, in order to insert numbers properly.

I have added all the necesery OnClickListeners and used for example this code for number 1

editText1.setText("1");

But, when i try to press the 1 button multiple times, it doesn't type 111 etc. It keeps replacing the last number that was inputed. So if i press 1 and then 2, it just replaces 1 with 2.

Any idea on how this can work please? :D

Это было полезно?

Решение

setText sets the text. It doesn't append the text. If you want to append, use editText1.setText(editText1.getText()+"1");

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top