Reputation: 10646
I have an AlertDialog containing a ListView. One Item on the ListView has an EditText.
When cliking the EditText the keyboard won't show :
The code for EditText
(I don't think that's what causing the issue)
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editableEditText"
android:layout_weight="1"
android:maxLines="1"/>
Upvotes: 0
Views: 374
Reputation: 1073
Try to use setSoftInputMode
Example code snippet -
AlertDialog.Builder b = new AlertDialog.Builder(this);
...
AlertDialog dialog = b.create();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
dialog.show();
Upvotes: 1
Reputation: 1609
Try It
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
Upvotes: 0
Reputation: 5904
try to add this code:
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
should be the way. To me worked
EDIT:
this is another way i found:
Dialog = builder.create(); Dialog.show();
Dialog.getWindow().clearFlags(
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
Dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
Upvotes: 2