List of usage examples for android.view.inputmethod InputMethodManager hideSoftInputFromWindow
public boolean hideSoftInputFromWindow(IBinder windowToken, int flags)
From source file:cn.count.easydrive366.CarRegistrationEditActivity.java
private void save() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(((EditText) findViewById(R.id.edt_carregistration_plate_no)).getWindowToken(), 0);/*from ww w .j av a 2 s. co m*/ if (!this.isOnline()) { this.showMessage(this.getResources().getString(R.string.no_network), null); return; } String url = String.format( "api/add_car_registration?user_id=%d&car_id=%s&engine_no=%s&vin=%s&init_date=%s&owner_name=%s&owner_license=%s", AppSettings.userid, ((EditText) findViewById(R.id.edt_carregistration_plate_no)).getText().toString().toUpperCase(), ((EditText) findViewById(R.id.edt_carregistration_engine_no)).getText().toString().toUpperCase(), ((EditText) findViewById(R.id.edt_carregistration_vin)).getText().toString().toUpperCase(), ((TextView) findViewById(R.id.edt_carregistration_registration_date)).getText(), ((EditText) findViewById(R.id.edt_carregistration_owner_name)).getText().toString().toUpperCase(), ((EditText) findViewById(R.id.edt_carregistration_owner_license)).getText().toString() .toUpperCase()); this.get(url, 2, this.getResources().getString(R.string.app_uploading)); }
From source file:biz.easymenu.easymenung.NoteDialog.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = li.inflate(R.layout.notedialog, container, false); WindowManager.LayoutParams WMLP = this.getDialog().getWindow().getAttributes(); WMLP.y = 100; //y position WMLP.gravity = Gravity.TOP;/*from w w w . j a v a2s .com*/ WMLP.windowAnimations = R.style.PauseDialogAnimation; this.getDialog().getWindow().setAttributes(WMLP); this.getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); etNote = (EditText) v.findViewById(R.id.txtNoteDlg); btnNoteOk = (Button) v.findViewById(R.id.btnNoteOK); btnNoteOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { itemFrag.setNote(etNote.getText().toString()); InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(etNote.getWindowToken(), 0); dismiss(); } }); btnNoteCancel = (Button) v.findViewById(R.id.btnNoteCancel); btnNoteCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(etNote.getWindowToken(), 0); dismiss(); } }); etNote.setText(note); return v; }
From source file:com.insthub.O2OMobile.Activity.C15_EditPriceActivity.java
private void CloseKeyBoard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mPrice.getWindowToken(), 0); }
From source file:app.presentation.sections.user_demo.list.UsersFragment.java
private void hideKeyboard(final View view) { view.clearFocus();/* w w w .j a v a 2s. com*/ InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:com.firesoft.member.Activity.B0_SigninActivity.java
private void CloseKeyBoard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mMobile.getWindowToken(), 0); }
From source file:com.javierc.albuquerquenow.SearchMap.java
private OnQueryTextListener n() { // TODO Auto-generated method stub return new OnQueryTextListener() { @Override//w ww .j av a2s . com public boolean onQueryTextSubmit(String arg0) { // TODO Auto-generated method stub InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); //Toast.makeText(getBaseContext(), arg0, Toast.LENGTH_SHORT).show(); try { new SearchFoursquare().execute(String.valueOf(googlemap.getMyLocation().getLatitude()), String.valueOf(googlemap.getMyLocation().getLongitude()), arg0); } catch (Exception e) { // TODO: handle exception } return false; } @Override public boolean onQueryTextChange(String arg0) { // TODO Auto-generated method stub googlemap.clear(); return false; } }; }
From source file:com.android.cts.uiautomator.Test3DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { View rootView = inflater.inflate(R.layout.test3_detail_fragment, container, false); mTextClock = (TextView) rootView.findViewById(R.id.test3ClockTextView); mSubmitButton = (Button) rootView.findViewById(R.id.test3SubmitButton); mEditText = (EditText) rootView.findViewById(R.id.test3TextField); mSubmitButton.setOnClickListener(new Button.OnClickListener() { @Override/*from w w w . ja va 2 s . co m*/ public void onClick(View v) { // close soft keyboard InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0); // display the submitted text AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.test3_dialog_title); builder.setPositiveButton(R.string.OK, null); CharSequence inputText = mEditText.getText(); if (inputText != null && !inputText.toString().isEmpty()) { long inputTime = Long.parseLong(inputText.toString()); builder.setMessage("" + (mCurrentTime - inputTime)); } else { builder.setMessage("<NO DATA>"); } AlertDialog diag = builder.create(); diag.show(); mEditText.setText(""); mRunCounter = false; } }); new Thread(new Runnable() { @Override public void run() { while (mRunCounter) { synchronized (sync) { mCurrentTime = SystemClock.elapsedRealtime(); } mHandler.post(mClockRunnable); SystemClock.sleep(100); } } }).start(); return rootView; }
From source file:com.andrew.apollo.menu.BasePlaylistDialog.java
/** * Closes the soft keyboard//w w w . j a v a 2s .c o m */ protected void closeKeyboard() { final InputMethodManager mInputMethodManager = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); mInputMethodManager.hideSoftInputFromWindow(mPlaylist.getWindowToken(), 0); }
From source file:co.juliansuarez.libwizardpager.wizard.ui.CustomerInfoFragment.java
@Override public void setMenuVisibility(boolean menuVisible) { super.setMenuVisibility(menuVisible); // In a future update to the support library, this should override setUserVisibleHint // instead of setMenuVisibility. if (mNameView != null) { InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); if (!menuVisible) { imm.hideSoftInputFromWindow(getView().getWindowToken(), 0); }/* w w w. j ava 2 s . c om*/ } }
From source file:com.androzic.route.RouteProperties.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_save: try {//from w ww . j ava 2s. c o m route.name = name.getText().toString(); route.show = show.isChecked(); route.lineColor = color.getColor(); String w = (String) width.getItemAtPosition(width.getSelectedItemPosition()); route.width = Integer.valueOf(w.trim()); final Androzic application = Androzic.getApplication(); application.dispatchRoutePropertiesChanged(route); // Hide keyboard final InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getView().getWindowToken(), 0); // "Close" fragment getFragmentManager().popBackStack(); } catch (Exception e) { Toast.makeText(getActivity(), "Error saving route", Toast.LENGTH_LONG).show(); } default: return super.onOptionsItemSelected(item); } }