2

I want to know when the keyboard is closed, so I'm using android:configChanges="orientation|keyboardHidden". I have to override the method onConfigurationChanged, but nothing seems to happen. Am I doing something wrong?

Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
Bakih
  • 286
  • 1
  • 6
  • 13

2 Answers2

1

watching the date , possibly you have a solution for your question, otherwise:

Here is the same response i made to another question related : Is there a way to tell if the soft-keyboard is shown?

but i copy a portion of the response here to avoid dead links:

Here is a specific sample:

Check for a better understand http://developer.android.com/guide/topics/resources/runtime-changes.html

    
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    // Checks the orientation of the screen
    if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
    } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
        Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
    }
    // Checks whether a hardware keyboard is available
    if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
        Toast.makeText(this, "keyboard visible", Toast.LENGTH_SHORT).show();
    } else if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
        Toast.makeText(this, "keyboard hidden", Toast.LENGTH_SHORT).show();
    }
}

I hope this help you

Community
  • 1
  • 1
yeradis
  • 5,235
  • 5
  • 25
  • 26
0

Have you added super.onConfigurationChanged(newConfig); in the overridden method?

Galip
  • 5,435
  • 10
  • 37
  • 47