0

Possible Duplicate:
Is there a way to tell if the soft-keyboard is shown?

In an application i want to check Softkeyboard is shown on the activity screen .

plz help

Community
  • 1
  • 1
  • I think we can show and hide the softkeyboard but we can't get the visibility status of softkeyboard. – Sankar Aug 24 '12 at 08:58
  • 2
    Going off [this question](http://stackoverflow.com/questions/3568919/android-how-can-i-tell-if-the-soft-keyboard-is-showing-or-not), it appears as though it's not possible to check. – Closeratio Aug 24 '12 at 09:01

1 Answers1

1

There is a workaround if you are interested, you can use getCurrentFocus() to return the view which is in focus and check if its an instance of EditText, if it is then you know the softkeyboard is visible, provided the primary input in softkeyboard and not physical keyboard.

protected boolean IsSoftKeyboardVisible(){
if(getCurrentFocus()!=null && getCurrentFocus() instanceof EditText){
        return true;
    }
return false;
}
Ashwin Singh
  • 7,197
  • 4
  • 36
  • 55