views:

90

answers:

1

Hi guys,

I have a textView with some text in it. I want to delete the last 4 characters and then add on some more text. I tried doing this.

textViewObject.append("\b\b\b\b new text that I am adding");

But instead of the \b doing a backspace, they show up as little squares in the textfield. Can anyone help me out here?

+1  A: 

You should be able to achieve the same effect by grabbing all the text except the last 4 characters and then appending your new text.

String textViewText = textViewObject.getText().toString();
textViewObject.setText(textViewText.substring(0, textViewText.getLength() - 4) + 
                                                   " new text that I am adding");
Quintin Robinson
Thanks, that worked!
Adam
@Adam Glad to hear it!
Quintin Robinson