List of usage examples for android.view.inputmethod InputMethodManager hideSoftInputFromInputMethod
@Deprecated public void hideSoftInputFromInputMethod(IBinder token, int flags)
From source file:Main.java
public static void hideKeyboard(Context c, View v) { InputMethodManager mgr = (InputMethodManager) c.getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromInputMethod(v.getWindowToken(), 0); }
From source file:com.radicaldynamic.groupinform.application.Collect.java
/** * Creates and displays a dialog displaying the violated constraint. *///from w ww . jav a 2s. c o m public void showSoftKeyboard(View v) { InputMethodManager inputManager = (InputMethodManager) getBaseContext() .getSystemService(Context.INPUT_METHOD_SERVICE); IBinder b = v.getWindowToken(); if (viewToken != null && !viewToken.equals(b)) { inputManager.hideSoftInputFromInputMethod(viewToken, 0); } if (inputManager.isActive(v)) return; inputManager.showSoftInput(v, 0); viewToken = b; }
From source file:info.xuluan.podcast.SearchActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.search_activity); setTitle(getResources().getString(R.string.title_channels)); mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mStrings); setListAdapter(mAdapter);/*from w ww. j a v a 2 s . c o m*/ getListView().setOnCreateContextMenuListener(this); mEditText = (EditText) findViewById(R.id.keywords); mEditText.addTextChangedListener(this); startInit(); Button next = (Button) findViewById(R.id.ButtonNext); next.setEnabled(false); next.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String str = "&start=" + mStart; String url = getUrl(); if (url != null) { start_search(url + str); } } }); ImageButton start = (ImageButton) findViewById(R.id.ButtonStart); start.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { InputMethodManager m = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); m.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS); m.hideSoftInputFromInputMethod(mEditText.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); String str = "&start=" + mStart; String url = getUrl(); if (url != null) { start_search(url + str); } } }); TabsHelper.setChannelTabClickListeners(this, R.id.channel_bar_search_button); }
From source file:th.in.ffc.person.PersonListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { case R.id.add: Intent add = new Intent(Action.INSERT); add.addCategory(Category.PERSON); add.addCategory(Category.DEFAULT); if (mHcode != null) { add.putExtra(Person.HCODE, mHcode); }//from ww w .j av a 2 s.c o m getFFCActivity().startActivity(add); break; case R.id.search: InputMethodManager imm = (InputMethodManager) getFFCActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); if (!mInput.isShown()) { mInput.setVisibility(View.VISIBLE); mInput.requestFocus(); imm.showSoftInput(mInput, InputMethodManager.SHOW_FORCED); item.setIcon(R.drawable.ic_action_close); } else { imm.hideSoftInputFromInputMethod(mInput.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); mInput.setVisibility(View.GONE); mInput.setText(null); item.setIcon(R.drawable.ic_action_search); } break; default: break; } return super.onOptionsItemSelected(item); }