android edittext cursor back side moving

  • Replies:1
gurumoorthy
  • Forum posts: 1

Sep 14, 2011, 6:53:59 AM via Website

I'm using gestures in android now i need small help when ever my gestures action will be equl my edit text cursor will be need to go back(like move back arrow) my code is

if (prediction.equals("Move")) {
?????????
}

it will be happen for gestures operation

Reply
Jeremiah
  • Forum posts: 775

Sep 14, 2011, 9:58:09 PM via Website

There is no "move cursor" method for an editText, but I believe you can set the cursor position using the setSelection method. Try doing this:

int cursorPos = myEditText.getSelectionStart();
cursorPos--;
if (cursorPos<0) cursorPos=0;
myEditText.setSelection(cursorPos)

Reply