android edittext cursor back side moving

  • Replies:1
  • OpenNot stickiedUnanswered

Sep 14, 2011 6:53:59 AM

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

Sep 14, 2011 9:58:09 PM

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)