List of usage examples for android.view View getContext
@ViewDebug.CapturedViewProperty public final Context getContext()
From source file:Main.java
public static void hideKeyboard(View view) { InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }/*from ww w .j a va2s .c o m*/ }
From source file:Main.java
public static Activity findActivity(View view) { if (view == null) { return null; }//ww w . j a v a 2s . c o m View targetView = view; while (true) { if (targetView.getContext() instanceof Activity) { return (Activity) targetView.getContext(); } if (!(targetView.getParent() instanceof View)) { return null; } targetView = (View) targetView.getParent(); } }
From source file:Main.java
public static void animate(View view, int resAnim) { Animation animFadein = AnimationUtils.loadAnimation(view.getContext(), resAnim); view.startAnimation(animFadein);//from ww w. j a v a 2s .com }
From source file:Main.java
private static void animSlideIn(View view, int resAnim) { Animation animation = AnimationUtils.loadAnimation(view.getContext(), resAnim); view.startAnimation(animation);/*from www. ja v a 2s . c o m*/ view.setVisibility(View.VISIBLE); }
From source file:Main.java
public static boolean hideInputSoft(View trigger) { InputMethodManager inputMethodManager = (InputMethodManager) trigger.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); return inputMethodManager.hideSoftInputFromWindow(trigger.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:Main.java
public static void hideKeyboard(@NonNull View view) { InputMethodManager inputManager = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static boolean hideSoftInput(View view) { InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); return imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static void hideIme(@NonNull View view) { InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:Main.java
public static boolean showSoftInput(View view) { InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); return imm.showSoftInput(view, InputMethodManager.SHOW_FORCED); }
From source file:Main.java
public static void hideInput(View view) { try {/*from w ww.j a va 2 s . c o m*/ InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } catch (Exception e) { e.printStackTrace(); } }