Is this the correct way to insert text at the cursor in Android?
Posted
by Ben L.
on Stack Overflow
See other posts from Stack Overflow
or by Ben L.
Published on 2010-05-31T18:34:52Z
Indexed on
2010/05/31
18:43 UTC
Read the original article
Hit count: 204
myInput.setText(myInput.getText().replace(myInput.getSelectionStart(), myInput.getSelectionEnd(), "text"));
(myInput
is an EditText
)
I ask because I think this code is much longer than it needs to be - Is there something shorter like myInput.insertTextAtCursor("text")
or is this the way everyone does it?
© Stack Overflow or respective owner