0

I have created a EditText,Custom IME SoftKeyboard and a button. I want that when my app opens and I click on EditText, it opens with my Custom IME Softkeyboard and when I click on the button, it switches to Default Keyboard. When I again click on the button, it switches back again to IME SoftKeyboard. So, Basically I am looking for a functionality of OnClick on a button that switches between Default Keyboard and Custom IME Softkeyboard.

I explored InputMethodManager but I only got the way to show the default keyboard.

mKeyboardSwitcher.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                InputMethodManager imm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
            }
        });

This is my code. Its just shows up the default keyboard.

I want the button to switch between Default keyboard and Custom Keyboard.

Anant Jain
  • 29
  • 8
  • by `Custom SoftKeyboard` you mean you created a view with buttons? To switch between system one and your custom, you need to hide system one and show your. And then - to hide yourth and show system one – Vladyslav Matviienko Sep 10 '19 at 06:10
  • No, I created a System IME SoftKeyboard using InputMethodService class. So, its not a view with buttons. Its an IME SoftKeyboard which can be used by any app as it is a kind of System Keyboard. – Anant Jain Sep 10 '19 at 06:14
  • [The second answer in this might help](https://stackoverflow.com/questions/11036435/switch-keyboard-profile-programmatically) – dustblue Sep 10 '19 at 06:16
  • I tried but its only applicable to apps with system privileges. My app doesn't have system privileges hence it is showing me that my app doesn't have Write_Secure_Settings Permission. – Anant Jain Sep 10 '19 at 06:59

0 Answers0