List of usage examples for android.view View getWindowToken
public IBinder getWindowToken()
From source file:Main.java
public static void hideSoftKeyboard(final Activity activity) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm == null) { return;//w ww . ja va2 s . co m } View view = activity.getCurrentFocus(); if (view == null) { view = new View(activity); } imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
/** * Hide keyboard/*from ww w .j a v a2 s . c o m*/ * * @param act * Activity * @param view */ public static void hideKeyboard(Activity act, View view) { InputMethodManager imm = (InputMethodManager) act.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:Main.java
public static void putAwaySoftKeyboard(Context context, View view) { InputMethodManager manager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); manager.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
/** * Hides the SoftKeyboard input careful as if you pass a view that didn't open the * soft-keyboard it will ignore this call and not close * * @param context the context / usually the activity that the view is being shown within * @param v the view that opened the soft-keyboard *///from www . ja v a 2 s .c o m public static void requestHideKeyboard(Context context, View v) { InputMethodManager imm = ((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); }
From source file:Main.java
public static void closeSoftInput(Context context, View focusingView) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(focusingView.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN); }
From source file:Main.java
public static void hiddenKeybroad(View v, Context context) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); }
From source file:Main.java
/** * Magic to close the soft keyboard.//from w w w .ja v a 2 s . c o m * * See http://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard * * @param context The context. * @param focusedView The focused view. */ public static void closeSoftKeyboard(Context context, View focusedView) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(focusedView.getWindowToken(), 0); }
From source file:Main.java
public static void hideKeyBoard(View view, Context context) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
@SuppressLint("NewApi") public static void isHideKeyboard(View view, Context context) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static final void hideSwKeyBoard(View v, Activity activity) { final InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); }