So i have a custom alert dialog with an EditText. Whenever i click a button to confirm, or if i click the soft keyboard's own done-button, i have programmed the app to close the dialog. However for some strange reason the soft-keyboard is still open after the alert dialog is closed...
This piece of code at the end of  buttonConfirm is what i tried to solve this issue. For some reason the code don't work for the button itself but the code does work for the done-button in the soft keyboard 
buttonConfirm.setOnClickListener(new 
    View.OnClickListener()
    {..............
    .................
         closeKeyboard();
         Handler handler = new Handler();
         handler.postDelayed(new Runnable() {
         @Override
         public void run() {
             dialog.dismiss();
         }
     }, 100); // 5000ms delay
}
//This is the code for the done-button in the `soft keyboard`
textinputEdit.setOnEditorActionListener(new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event){
         if(actionId==EditorInfo.IME_ACTION_DONE){
              buttonConfirm.performClick();
         }
         return false;
       }
});
So why does that work but not the button itself when directly pressing on it? This is very strange to me.. Anyone know what the hell is going on? :(
 
     
     
     
    