Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't the virtual keyboard go away?

I have a pretty simple screen with a couple of EditText widgets and a button. In the emulator, when I click on the EditText widget, a virtual keyboard comes up. However, I can't seem to get rid of it. Clicking on an empty space on the screen does not make it go away. Only clicking the virtual Return key or the hardware Back button makes it disappear.

I don't have a real Android phone handy, so is this an emulator only thing or will it be like this on the actual device. If it is, what can I do to make the virtual keyboard go away, when I click elsewhere on the form?

like image 434
AngryHacker Avatar asked Dec 29 '10 06:12

AngryHacker


4 Answers

Click the back button. They keyboard is an activity. There's not an easy way to remove the keyboard when clicking on a random area of the screen.

like image 103
Falmarri Avatar answered Nov 08 '22 20:11

Falmarri


AngryHacker , I woud refer you to this post how to close/hide the android soft keyboard.

Hope this helps.

like image 28
100rabh Avatar answered Nov 08 '22 20:11

100rabh


I think in the emulator you can press Escape to hide the keyboard. On a real device there is a hide button on the keyboard or you can press elsewhere in the ui. That's how it works on my HTC Desire S anyway.

like image 38
Caltor Avatar answered Nov 08 '22 22:11

Caltor


I lived this problem and i resolved it. This problem is about InputMethodManager.SHOW_FORCED value in my project. When i open keypad using SHOW_FORCEDthen when i try to close keypad, keypad was not closing.

For Example :

activity.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view, InputMethodManager.SHOW_FORCED);

If you use above way to open keypad, you may try to change SHOW_FORCED value with SHOW_IMPLICIT value

For Example :

activity.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
like image 37
oguzhan Avatar answered Nov 08 '22 20:11

oguzhan