List of usage examples for android.view.inputmethod InputMethodManager toggleSoftInput
public void toggleSoftInput(int showFlags, int hideFlags)
From source file:com.brookmanholmes.bma.ui.newmatchwizard.CreateNewMatchActivity.java
public void showKeyboard() { if (pager.getCurrentItem() == 0) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); }/*from w ww . j a v a 2 s.co m*/ }
From source file:com.nice295.fridgeplease.MainActivity.java
private void showAddDialog() { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this, R.style.DialogTheme); LayoutInflater inflater = this.getLayoutInflater(); final View dialogView = inflater.inflate(R.layout.dialog_add, null); dialogBuilder.setView(dialogView);/* w ww . j ava 2s .c o m*/ final EditText etNewString = (EditText) dialogView.findViewById(R.id.edit); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); dialogBuilder.setTitle(getString(R.string.add_new_string)); //dialogBuilder.setMessage(""); dialogBuilder.setPositiveButton(getString(R.string.add), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (etNewString.getText() != null) { addNewMyItem(etNewString.getText().toString(), 0, "https://firebasestorage.googleapis.com/v0/b/fridgeplease.appspot.com/o/items%2Fgeneral.png?alt=media&token=b47ab1e6-1d1f-4c9d-b8f2-d2ac9e3f8374"); etNewString.clearFocus(); etNewString.setText(""); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); } else { Log.e(TAG, "Input Text!"); } } }); dialogBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); } }); AlertDialog b = dialogBuilder.create(); b.show(); }
From source file:com.vikingbrain.dmt.view.RemoteControlActivity.java
/** * Show the keyboard./* ww w . j a v a 2 s . c om*/ */ private void showKeyboard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); isKeyboardShowing = true; } }
From source file:com.vikingbrain.dmt.view.RemoteControlActivity.java
/** * Hide the keyboard.//from www .j a v a 2 s . c o m */ private void hideKeyboard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.toggleSoftInput(0, InputMethodManager.HIDE_IMPLICIT_ONLY); isKeyboardShowing = false; } }
From source file:com.amberfog.countryflagsdemo.BaseFlagFragment.java
protected void showKeyboard(View v) { InputMethodManager imm = (InputMethodManager) v.getContext().getApplicationContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); }
From source file:de.questmaster.fatremote.fragments.RemoteFragment.java
private void showKeyboard() { // show edittext and give it focus ImageView button = (ImageView) c.findViewById(R.id.textButton); EditText text = (EditText) c.findViewById(R.id.enterText); button.setVisibility(View.GONE); text.setVisibility(View.VISIBLE); text.requestFocus();/*from w w w . j a va 2s .com*/ // show keyboard InputMethodManager mgr = (InputMethodManager) c.getSystemService(Context.INPUT_METHOD_SERVICE); mgr.toggleSoftInput(0, 0); }
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 w w .java 2s.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:ua.com.spacetv.mycookbook.dialogs.FragDialog.java
/** * Showing software keyboard//from w ww .j a v a2s . co m */ private void showKeyboard() { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); }
From source file:com.twentyfourseven.zira.DriverProfileInformation.java
@Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.btnSeeDriverLocation: // Building Parameters tripId and DriverId if (Util.isNetworkAvailable(DriverProfileInformation.this)) { ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("DriverId", mTripDetailsModel.getGetTrip_DriverId())); params.add(new BasicNameValuePair("TripId", SingleTon.getInstance().getDriverTripId())); Log.d("tag", "GetDriver Location::" + params.toString()); AsyncTaskForZira mWebPageTask1 = new AsyncTaskForZira(DriverProfileInformation.this, "GetDriverLocation", params, false, ""); mWebPageTask1.delegate = (AsyncResponseForZira) DriverProfileInformation.this; mWebPageTask1.execute();/*from w ww.ja va 2 s . com*/ } else { Util.alertMessage(DriverProfileInformation.this, "Please check your internet connection"); } break; case R.id.imageView_Message: InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); layoutDialog.setVisibility(View.VISIBLE); break; case R.id.buttonSend: try { InputMethodManager imm1 = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm1.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); } catch (Exception e) { // TODO: handle exception } if (edtMessage.getText().length() == 0) { Util.alertMessage(DriverProfileInformation.this, "Please Write Message"); } else { String userid = mTripDetailsModel.getGetTrip_DriverId(); String message = edtMessage.getText().toString(); String trigger = "sms"; Log.i("tag", "userid:" + userid); Log.i("tag", "message:" + message); Log.i("tag", "trigger:" + trigger); // Building Parameters if (Util.isNetworkAvailable(DriverProfileInformation.this)) { ArrayList<NameValuePair> params1 = new ArrayList<NameValuePair>(); params1.add(new BasicNameValuePair("Id", userid)); params1.add(new BasicNameValuePair("message", message)); params1.add(new BasicNameValuePair("trigger", trigger)); Log.d("tag", "SendRequest::" + params1.toString()); AsyncTaskForZira mWebPageTask = new AsyncTaskForZira(DriverProfileInformation.this, sendMessages, params1, true, "Sending message..."); mWebPageTask.delegate = (AsyncResponseForZira) DriverProfileInformation.this; mWebPageTask.execute(); } else { Util.alertMessage(DriverProfileInformation.this, "Please check your internet connection"); } // new SendMessageParsing().execute(); edtMessage.setText(""); } break; case R.id.imageViewDelete: try { InputMethodManager imm1 = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm1.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); } catch (Exception e) { // TODO: handle exception } edtMessage.setText(""); layoutDialog.setVisibility(View.GONE); break; /*case R.id.imageView_Phone: Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse(jsonmobileno)); startActivity(callIntent); System.err.println("callllllllll"); break;*/ } }
From source file:com.vaquerosisd.projectmanager.TaskList.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { if (taskSelected) menu.findItem(R.id.actionBar_DeleteTaskIcon).setVisible(true); else/*from w w w. j a va 2s . co m*/ menu.findItem(R.id.actionBar_DeleteTaskIcon).setVisible(false); if (searching) { getActionBar().setDisplayShowTitleEnabled(false); menu.findItem(R.id.actionBar_SearchTaskIcon).setVisible(false); menu.findItem(R.id.actionBar_SearchTaskItem).setVisible(true); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); } else { getActionBar().setDisplayShowTitleEnabled(true); MenuItem searchItem = menu.findItem(R.id.actionBar_SearchTaskItem); final EditText searchProject = (EditText) searchItem.getActionView() .findViewById(R.id.actionBar_SearchItemEditText); searchProject.setText(""); menu.findItem(R.id.actionBar_SearchTaskIcon).setVisible(true); menu.findItem(R.id.actionBar_SearchTaskItem).setVisible(false); } MenuItem logMenuItem = menu.findItem(R.id.actionBar_Menu_user); if (currentUser != null) { logMenuItem.setTitle("Log Out from " + currentUser.getUsername()); } else { checkUser(); } return true; }