OnInputShowListener Android - Is it possible to determine if any soft keyboard is displayed?

after fixing another problem in my android application, I came to another.

It would be important that I could do something, for example, hide some visual elements if SoftKeyboard is shown, such as Input, like Swipe or a regular Android keyboard.

I tried onConfigurationChange = "KeyboardShow" (pseudocode), but did not receive any changes to get an event when, for example, skype is shown.

So now my question is: is there any solution or function or listener that I can handle this action?

Hope someone can help me.

Sincerly, Mike Penz

+3
source share
1

, : android:configChanges="keyboardHidden" . , Configuration

static Configuration prevConf = Configuration();
static int ignoreMasks = Configuration.HARDKEYBOARDHIDDEN_NO|Configuration.HARDKEYBOARDHIDDEN_YES;

onCreate() {
   prevConf = setToDefaults();
}
// all your code here

@Override
public void onConfigurationChanged (Configuration newConfig) {
    int deltas = newConfig.diff (prevConf); // what changed?
    prevConf = newConfig;

    if (delta & ignoreMasks) 
        return; // you're not interested in hard keyboards.

    //  your code here 
}

, .

API:

http://developer.android.com/reference/android/R.attr.html#configChanges

http://developer.android.com/reference/android/app/Activity.html#onConfigurationChanged%28android.content.res.Configuration%29

http://developer.android.com/reference/android/content/res/Configuration.html

0

All Articles