diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/housenumber/AddHousenumberForm.java b/app/src/main/java/de/westnordost/streetcomplete/quests/housenumber/AddHousenumberForm.java index 7fae4c2db3..7254bd7d79 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/housenumber/AddHousenumberForm.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/housenumber/AddHousenumberForm.java @@ -196,6 +196,8 @@ private void initKeyboardButton(View view) if(focus != null && focus instanceof EditText) { EditText input = (EditText) focus; + int start = input.getSelectionStart(); + int end = input.getSelectionEnd(); if ((input.getInputType() & InputType.TYPE_CLASS_NUMBER) != 0) { input.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); @@ -206,6 +208,8 @@ private void initKeyboardButton(View view) input.setKeyListener(DigitsKeyListener.getInstance("0123456789.,- /")); toggleKeyboardButton.setText("abc"); } + // for some reason, the cursor position gets lost first time the input type is set (#1093) + input.setSelection(start, end); InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT);