Hide ime in go to dialog

This commit is contained in:
seven332 committed 2016-04-09 20:41:52 +08:00
1 parent 2d65b71fff
commit e10172c09c
2 files changed
+11

No files matched your search

@@ -17,6 +17,7 @@
package com.hippo.util;
import android.app.Activity;
import android.app.Dialog;
import android.app.Service;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -86,4 +87,12 @@ public class AppHelper {
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
public static void hideSoftInput(Dialog dialog) {
View view = dialog.getCurrentFocus();
if (view != null) {
InputMethodManager imm = (InputMethodManager) dialog.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
}