本文整理汇总了Java中android.view.inputmethod.InputMethodManager.restartInput方法的典型用法代码示例。如果您正苦于以下问题:Java InputMethodManager.restartInput方法的具体用法?Java InputMethodManager.restartInput怎么用?Java InputMethodManager.restartInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.inputmethod.InputMethodManager
的用法示例。
在下文中一共展示了InputMethodManager.restartInput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFocusChanged
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
@Override
public void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
// Make search icon inactive when edit toolbar search term isn't a user entered
// search term
final boolean isActive = !TextUtils.isEmpty(getText());
if (mSearchStateChangeListener != null) {
mSearchStateChangeListener.onSearchStateChange(isActive);
}
if (gainFocus) {
resetAutocompleteState();
return;
}
removeAutocomplete(getText());
final InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
try {
imm.restartInput(this);
imm.hideSoftInputFromWindow(getWindowToken(), 0);
} catch (NullPointerException e) {
Log.e(LOGTAG, "InputMethodManagerService, why are you throwing"
+ " a NullPointerException? See bug 782096", e);
}
}