2

I'd like to set focus to an EditText and automatically bring up the virtual keyboard in certain situations. However, if a phone's hardware keyboard is slid out, I wouldn't want to. Is there any way to detect whether or not a phone's hardware keyboard (if one exists) is slid out? Or is there some functionality of the EditText that will handle all this for me?

Andrew
  • 20,756
  • 32
  • 99
  • 177

1 Answers1

4
if (getResources().getConfiguration().hardKeyboardHidden==Configuration.HARDKEYBOARDHIDDEN_NO)
    {
    //do stuff
    }

To dive deeper, triggering OnConfigurationChanged on keyboard slide is explained in Activity restart on rotation Android

Community
  • 1
  • 1
Adrian Spinei
  • 550
  • 5
  • 15