Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show keyboard on activity start when focusing to editor #74

Closed
karandatwani92 opened this issue Aug 4, 2016 · 4 comments
Closed

Comments

@karandatwani92
Copy link

i requested the focus by mEditor.focusEditor(); and then code to show keyboard which works with edittext. but with editor, it's not working.

@cobear25
Copy link

It looks like if you select in manually first, then requesting focus works, but when the page loads it looks like something isn't initialized until you tap the editor.

@xinyangmaojian
Copy link

thanks for mEditor.focusEditor()

@apradanas
Copy link

I had the same problem. While focusEditor() doesn't work, I show soft keyboard manually after the editor initially loaded.

editor.setOnInitialLoadListener(isReady -> {
            if (isReady) {
                editor.focusEditor();
                InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.toggleSoftInputFromWindow(editor.getWindowToken(), InputMethodManager.SHOW_IMPLICIT, 0);
            }
        });

@ldlywt
Copy link

ldlywt commented May 6, 2023

in BottomSheetDialogFragment:

        binding.richEditor.setOnInitialLoadListener { isReady ->
            if (isReady) {
                binding.richEditor.focusEditor()
                binding.richEditor.post {
                    val imm = requireActivity().getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
                    imm.toggleSoftInputFromWindow(binding.richEditor.windowToken, InputMethodManager.SHOW_IMPLICIT, 0)
                    requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
                }
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants