1
I’m Creating a keyboard to add value to a Textview. I was able to add a value only to Textview. But what I wanted to do was keep the current value and add another to the side so that the user can make a number to add to Textview.
At the Onclick event I did it:
switch (view.getId()) {
case R.id.buttonNum1:
txtNum.setText("1");
break;
case R.id.buttonNum2:
txtNum.setText("2");
break;
I would like to know how to keep the current value and add a new value to the side.
thanks a lot, I didn’t know the append
– Romão Gomes
how can I do to delete the last typed?
– Romão Gomes
I don’t know a function for that, it would have to be manual. If inserting only one character at a time is easier, you can remove with obj.setText(obj.gettext().substring(0, obj.gettext().length() - 2);. Already if it is possible to insert any type of text, then you could have a visible for the last insertion and use this variable together with lastIndexOf() to do the substring.
– res
worked perfectly only had to change a thingsbj.setText(obj.gettext(). subSequence(0, obj.gettext(). length() - 1));
– Romão Gomes