Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android softkeyboard never shows up in emulator

I'm new to Android. I've spent two hours already for searching. Whatever i try softkeyboard is never shown for my EditText. I create it simply:

EditText editText = (EditText)findViewById(R.id.editText); 

I tried:

 editText.requestFocus();//i tried without this line too  InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);  imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); 

and:

editText.setOnFocusChangeListener(new OnFocusChangeListener() {           @Override          public void onFocusChange(View v, boolean hasFocus)           {                           InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);                      imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);           }      }); 

i also tried:

getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE); 

i tried putting this line into AndroidManifest.xml file:

 android:windowSoftInputMode="stateVisible|adjustResize" 

but all in vain. It just never shows. What am i missing?

like image 967
Andrey Chernukha Avatar asked Aug 17 '13 11:08

Andrey Chernukha


People also ask

Why are my apps not showing on emulator?

The Best Answer is Probably the project you are running is not compatible (API version/Hardware requirements) with the emulator settings. Check in your build. gradle file if the targetSDK and minimumSdk version is lower or equal to the sdk version of your Emulator.

Why is my Android Emulator not working?

If the Android Emulator does not start properly, this problem is often caused by problems with HAXM. HAXM issues are often the result of conflicts with other virtualization technologies, incorrect settings, or an out-of-date HAXM driver. Try reinstalling the HAXM driver, using the steps detailed in Installing HAXM.


1 Answers

You need to make sure that your emulator is not set to use a hardware keyboard. This can be done by choosing Edit on a selected emulator in the AVD. Then uncheck the Hardware keyboard present setting.

You could also try using a different emulator, such as Genymotion. It supports full hardware acceleration (multi-core CPU as well as GPU) and runs much faster than any of the android emulator images. If you use Genymotion you will need to disable the hardware keyboard within Android (see below for details).

To disable hardware keyboard in Genymotion:
Go to Settings -> Language & input and open the Default item under Keyboard & Input Methods. There is a Hardware setting that you can toggle on/off. When it is on you use your physical keyboard and when it is off the standard soft keyboard should pop-up whenever a text field gets focus.

Screenshots for Genymotion settings: Default Item

enter image description here

like image 90
free3dom Avatar answered Oct 05 '22 20:10

free3dom