Cursor postion comes to start of the edittext
I have a small problem. In my activity I have an edittext and a button.
Clicking on the button I am changing the inputtype of the edittext.
Now when I click button the input type changes but the curs开发者_如何学JAVAor goes to the begining of the text in the edittext.
How can I retain the same position of the cursor or can I bring the cursor to the end of the text?
I tried setSelection(edittextobj.getText().length())
but doesnot work how can I achive this....?
Just to make sure, the complete code is:
edittextobj.setSelection(edittextobj.getText().length());
The code you have is correct, as far as it goes. The problem must lie elsewhere. Try ensuring your string is the correct string, and that you're setting everything in the correct order.
精彩评论