List of usage examples for android.app Activity getCurrentFocus
@Nullable
public View getCurrentFocus()
From source file:Main.java
public static void HideIme(Activity activity) { if (activity.getCurrentFocus() != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }/*from w w w . ja va 2 s . c o m*/ }
From source file:Main.java
public static void hideSoftKeyboard(Activity activity) { if (activity.getCurrentFocus() != null) { InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0); }//from w ww. ja v a 2 s. c o m }
From source file:Main.java
public static void hideSoftKeyboard(Activity activity) { if (activity != null && activity.getCurrentFocus() != null) { InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Activity.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0); }/*from w ww .java2s . co m*/ }
From source file:Main.java
public static void hideKeyboard(Activity activity) { View view = activity.getCurrentFocus(); InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); if (view == null) { return;/*from w w w . j a v a2 s. co m*/ } imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static boolean showSoftInput(Activity activity) { View view = activity.getCurrentFocus(); if (view != null) { InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); return imm.showSoftInput(view, 2); } else {//from w w w . j a v a 2s . c om return false; } }
From source file:Main.java
public static boolean hideSoftInput(Activity activity) { if (activity.getCurrentFocus() != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); return imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0); }//from w w w. j a v a2 s .c o m return false; }
From source file:Main.java
public static void hideKeyboard(Activity activity) { if (activity != null && activity.getCurrentFocus() != null) { InputMethodManager inputManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }/*from w w w. jav a2s . com*/ }
From source file:Main.java
public static void closeInputMethod(final Activity activity) { final View view = activity.getCurrentFocus(); if (view != null) { closeInputMethod(activity, view); }/*from w ww . java 2 s.c o m*/ }
From source file:Main.java
public static void hideKeyboard(Activity activity) { if (activity == null || activity.getCurrentFocus() == null) { return;/*w w w . j av a2s . c om*/ } InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Activity.INPUT_METHOD_SERVICE); if (inputMethodManager != null) { inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0); } }
From source file:Main.java
public static void hideInput(Activity activity) { if (activity != null && activity.getCurrentFocus() != null) { ((InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow( activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }/*from w ww.jav a 2 s . com*/ }