1

I have a tab which when clicked on will force open the keyboard. This works fine, but there is also a numerical input field on this app, so when I use this and go back to the tab which opens up the keyboard it opens up a numerical keyboard (number pad). How can I make it so it forces open the normal keyboard?

Here's the code that deals with the keyboard opening and closing on tab changes:

public void onTabChanged(String tab){
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    if(tab.equals("keyboardTab")) {
        // open keyboard
        imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
    }
    else {
        // close keyboard
        imm.hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0);
    }
}
Kai Hulme
  • 41
  • 9

1 Answers1

0

If "keyboardTab" contains some text field you may set attribute android:inputType="text" for it. This field has to receive focus before keyboard is forced to open.

  • There is no text field; the keyboard is forced open on tab change (as the code shows). I want to know how to force open a normal keyboard, much like you can tell the application to open a certain keyboard when selecting certain input fields. – Kai Hulme Dec 17 '15 at 17:27