tags:

views:

137

answers:

1

Hi,

I am using AlertDialog.Builder in order to create an input box, with EditText as the input method.

Unfortunately, the Soft Keyboard doesn't pop, although the EditText is in focus, unless you explicitly touch it again.

Is there a way to force it to pop?

I've tried the following, after the (AlertDialog.Builder).show(); but for no avail. InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.showSoftInput(input, InputMethodManager.SHOW_FORCED);

Anyone can help?

Thanks!!

A: 

This was answered here already. Using an OnFocusChangeListener worked for me.

dhaag23
The question asks how to set the soft input mode for an AlertDialog.Builder object, however the thread you refer to gives an example using an AlertDialog object. If I try to use the suggested code (using alert.getWindow().setSoftInputMode(...) within OnFocusChangeListener) Eclipse objects that the method getWindow() is not defined for the type AlertDialog.Builder. Can you help me fix this, please?