Show soft input keyboard

user940016 picture user940016 · Jul 13, 2012 · Viewed 9.7k times · Source

I'm trying to show the soft input keyboard for a view on the touch event. This line works:

inputManager.toggleSoftInputFromWindow(getWindowToken(),0,0);

But this line doesn't work:

inputManager.showSoftInput(this,0);

Why is it so? What if I want to connect the soft input to the view? Thanks.

Answer

Mohsin Naeem picture Mohsin Naeem · Jul 13, 2012

I think you are testing on emulator. not on real device?

It will not open the keyboard on AVD but it will open on real device, which does not have Hard key board.

To test it on AVD you need to disable the keyboard.

To disable keyboard use

Click on AVD manager > open you targeted AVD > Edit > Hardware > New > Keyboard Support > OK > Make it "NO"