2

do anyone know how i know when the keyboard is close? Thanks

Bakih
  • 286
  • 1
  • 6
  • 13

1 Answers1

0

To determine whether or not your keyboard his hidden (closed) or not, you can use one of the following approached which return to you an enumerated value indicating whether or not the type of keyboard you're requesting is hidden or not.

getResources().getConfiguration().hardKeyboardHidden

or

getResources().getConfiguration().keyboardHidden

The difference is that keyboardHidden will take soft keyboards into consideration along with hard keyboards, whereas hardKeyboardHidden will only tell you whether or not the hard keyboard is hidden.

sahhhm
  • 5,325
  • 2
  • 27
  • 22
  • Thanks for your answer , but how do i catch the pressing on "back key" to close the keyboard – Bakih Jan 10 '11 at 07:16
  • you need to handle some sort of KeyEvent (see: http://stackoverflow.com/questions/2261914/catch-keypress-with-android or various tutorials online...) You'll of course need to check and make sure that the keyBoard is not hidden when catching a back key press (for your particular scenario). – sahhhm Jan 10 '11 at 07:20