List of usage examples for android.view.inputmethod InputMethodManager showSoftInput
public boolean showSoftInput(View view, int flags)
From source file:org.videolan.vlc.gui.SearchFragment.java
@Override public void onResume() { super.onResume(); mSearchText.requestFocus();/*from w w w . ja va 2s. co m*/ InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mSearchText, InputMethodManager.SHOW_IMPLICIT); showSearchHistory(); }
From source file:org.exoplatform.shareextension.ComposeFragment.java
public void setTouchListener() { // Open the soft keyboard and give focus to the edit text field when the // scroll view is tapped scroller.setOnTouchListener(new View.OnTouchListener() { @Override/*from ww w. ja va 2 s . co m*/ public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { etPostMessage.requestFocus(); InputMethodManager mgr = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); mgr.showSoftInput(etPostMessage, InputMethodManager.SHOW_IMPLICIT); } return v.performClick(); } }); }
From source file:hku.fyp14017.blencode.ui.dialogs.MultiLineTextDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { View dialogView = LayoutInflater.from(getActivity()) .inflate(hku.fyp14017.blencode.R.layout.dialog_text_multiline_dialog, null); input = (EditText) dialogView.findViewById(hku.fyp14017.blencode.R.id.dialog_text_EditMultiLineText); if (getHint() != null) { input.setHint(getHint());//from w w w . j ava2s .c o m } input.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { getDialog().getWindow() .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); } } }); initialize(); Dialog dialog = new AlertDialog.Builder(getActivity()).setView(dialogView).setTitle(getTitle()) .setNegativeButton(hku.fyp14017.blencode.R.string.cancel_button, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dismiss(); } }).setPositiveButton(hku.fyp14017.blencode.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).create(); dialog.setCanceledOnTouchOutside(true); dialog.setOnShowListener(new OnShowListener() { @Override public void onShow(DialogInterface dialog) { Button buttonPositive = ((AlertDialog) getDialog()).getButton(DialogInterface.BUTTON_POSITIVE); buttonPositive.setEnabled(getPositiveButtonEnabled()); setPositiveButtonClickCustomListener(); InputMethodManager inputManager = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT); initTextChangedListener(); } }); return dialog; }
From source file:com.app.blockydemo.ui.dialogs.NewVariableDialog.java
private void handleOnShow(final Dialog dialogNewVariable) { final Button positiveButton = ((AlertDialog) dialogNewVariable).getButton(AlertDialog.BUTTON_POSITIVE); positiveButton.setEnabled(false);/*from ww w . j a v a2 s. c o m*/ EditText dialogEditText = (EditText) dialogNewVariable .findViewById(R.id.dialog_formula_editor_variable_name_edit_text); InputMethodManager inputMethodManager = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.showSoftInput(dialogEditText, InputMethodManager.SHOW_IMPLICIT); dialogEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable editable) { String variableName = editable.toString(); if (ProjectManager.getInstance().getCurrentProject().getUserVariables() .getUserVariable(variableName, ProjectManager.getInstance().getCurrentSprite()) != null) { Toast.makeText(getActivity(), R.string.formula_editor_existing_variable, Toast.LENGTH_SHORT) .show(); positiveButton.setEnabled(false); } else { positiveButton.setEnabled(true); } if (editable.length() == 0) { positiveButton.setEnabled(false); } } }); }
From source file:org.odk.collect.android.widgets.StringWidget.java
@Override public void setFocus(Context context) { // Put focus on text input field and display soft keyboard if appropriate. answerText.requestFocus();//from www .j a v a 2 s . co m InputMethodManager inputManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); if (!readOnly) { inputManager.showSoftInput(answerText, 0); /* * If you do a multi-question screen after a "add another group" dialog, this won't * automatically pop up. It's an Android issue. * * That is, if I have an edit text in an activity, and pop a dialog, and in that * dialog's button's OnClick() I call edittext.requestFocus() and * showSoftInput(edittext, 0), showSoftinput() returns false. However, if the edittext * is focused before the dialog pops up, everything works fine. great. */ } else { inputManager.hideSoftInputFromWindow(answerText.getWindowToken(), 0); } }
From source file:com.liferay.alerts.activity.SignInActivity.java
protected void showKeyboard() { final InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); Runnable runnable = new Runnable() { @Override/*from www . ja va 2s. c o m*/ public void run() { manager.showSoftInput(_server, InputMethodManager.SHOW_IMPLICIT); } }; int delay = getResources().getInteger(R.integer.compose_show_keyboard_delay); Handler handler = new Handler(); handler.postDelayed(runnable, delay); }
From source file:org.catrobat.catroid.ui.dialogs.MultiLineTextDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { View dialogView = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_text_multiline_dialog, null); input = (EditText) dialogView.findViewById(R.id.dialog_text_EditMultiLineText); if (getHint() != null) { input.setHint(getHint());/*from ww w . j a va 2s. c om*/ } input.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { getDialog().getWindow() .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); } } }); initialize(); Dialog dialog = new AlertDialog.Builder(getActivity()).setView(dialogView).setTitle(getTitle()) .setNegativeButton(R.string.cancel_button, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dismiss(); } }).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).create(); dialog.setCanceledOnTouchOutside(true); dialog.setOnShowListener(new OnShowListener() { @Override public void onShow(DialogInterface dialog) { if (getDialog() == null) { dismiss(); } else { Button buttonPositive = ((AlertDialog) getDialog()).getButton(DialogInterface.BUTTON_POSITIVE); buttonPositive.setEnabled(getPositiveButtonEnabled()); setPositiveButtonClickCustomListener(); InputMethodManager inputManager = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT); initTextChangedListener(); } } }); return dialog; }
From source file:com.hangulo.powercontact.util.Utils.java
private void showInputMethod(Context ctx, View view) { InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.showSoftInput(view, 0); }//from ww w . j a v a 2s . com }
From source file:com.firebase.ui.auth.ui.phone.SubmitConfirmationCodeFragment.java
@Override public void onStart() { super.onStart(); mConfirmationCodeEditText.requestFocus(); InputMethodManager imgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imgr.showSoftInput(mConfirmationCodeEditText, 0); }
From source file:th.in.ffc.person.PersonListFragment.java
public void onSearchRequest() { if (!mInput.isShown()) { mInput.setVisibility(View.VISIBLE); mInput.requestFocus();/*from w w w . j ava2 s. c o m*/ InputMethodManager imm = (InputMethodManager) getFFCActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mInput, InputMethodManager.SHOW_FORCED); } }