FormUtils { public static void hideKeyboard(final Context context, final TextView textView) { final InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(textView.getWindowToken(), 0); } } private  FormUtils(); static void showKeyboard(final Context context, final TextView textView); static void hideKeyboard(final Context context, final TextView textView);  }
@Test public void testHideKeyboard() throws Exception { FormUtils.hideKeyboard(mActivity, mTextView); }