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 cursor 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….?
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.