I have an EditText line on a UI screen for a user to enter a sentence. If the the user leaves the cursor in the middle of the sentence and then does an orientation change, I want the cursor to move to the end of the sentence. My understanding was that the OS creates a new Activity and new focus on orientation change so I set up the below code, but to no avail. Please advise.
partial Activity file:
... cListenerEditText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus && (cListenerEditText.getText().length() > 0)) { cListenerEditText.setSelection(cListenerEditText.getText().length()); } } });