Keyboard not showing inside Alert Dialog with ListView of EditText
android, android-alertdialog, android-edittext, keyboard, listview
Solution
I found a sollution thanks to Stackoverflow questions and answers which is by adding this to the listView (in case listView is in dialog )
//persoFomulair is a listView with editTexts
persoFomulair.post(new Runnable() {
@Override
public void run() {
dialog.getWindow().clearFlags(
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
}
});
Problem
``` //code of AlertDialog final AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); alert.setTitle(R.string.modification); persoFomulair=new ListView(getActivity()); List<HashMap<Boolean,HashMap<String,String>>>list = prepareList(p); MyListAdapter2 myListAdapter2 = new MyListAdapter2(getActivity(), R.layout.perso_list, list); persoFomulair.setAdapter(myListAdapter2); alert.setView(persoFomulair); alert.setPositiveButton(R.string.valider, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //What ever you want to do with the value getValueOfItem(); ModifierPerso modifierPerso = new ModifierPerso(); modifierPerso.execute(type, String.valueOf(p.getId()), date_embauch, salair_journ); } }); alert.setNegativeButton(R.string.annuler, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // what ever you want to do with No option. } }); AlertDialog alertDialog=alert.create(); alertDialog.getWindow().clearFlags( WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); alertDialog.show(); //what i think you need to see is the only parts from the array adapter bellow this comment if(type.equals("Date embauch :")){editText.setText(result);editText.setInputType(InputType.TYPE_DATETIME_VARIATION_DATE);} else if(type.equals("Salair Journal :")){editText.setText(result);editText.setInputType(InputType.TYPE_CLASS_NUMBER);} else {editText.setVisibility(View.GONE);textView.setText(type+result);} ``` While searching for my problem I found that it's because of using adjustPan in android Manifest. I'm using a list of EditTexts inside a dialog for which it will make it impossible in the way I wrote code to work. Also, it's long and will not let the keyboard to show to fit the screen. Here's a screenshot of the scenario: dialog Notice that in code I only want to make the selected EditText enabled and not the others one.