문제

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