Java Code Examples for android.widget.EditText#postDelayed()

The following examples show how to use android.widget.EditText#postDelayed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WXInput.java    From weex with Apache License 2.0 6 votes vote down vote up
@WXComponentProp(name = WXDomPropConstant.WX_ATTR_INPUT_AUTOFOCUS)
public void setAutofocus(boolean autofocus) {
  if (mHost == null) {
    return;
  }
  mAutoFocus = autofocus;
  EditText inputView = (EditText) mHost;
  if (mAutoFocus) {
    inputView.setFocusable(true);
    inputView.requestFocus();
    inputView.setFocusableInTouchMode(true);
    inputView.postDelayed(new Runnable() {
      @Override
      public void run() {
        showSoftKeyboard();
      }
    }, 16);
  } else {
    inputView.postDelayed(new Runnable() {
      @Override
      public void run() {
        hideSoftKeyboard();
      }
    }, 16);
  }
}
 
Example 2
Source File: KeyboardManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public static void setFocusAndOpenKeyboard(Context context, final EditText editText){
    final InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    editText.postDelayed(new Runnable() {
        @Override
        public void run() {
            editText.requestFocus();
            imm.showSoftInput(editText, 0);
        }
    }, 100);
}
 
Example 3
Source File: SpinnerDialog.java    From SSForms with GNU General Public License v3.0 5 votes vote down vote up
private void showKeyboard(final EditText ettext){
    ettext.requestFocus();
    ettext.postDelayed(new Runnable(){
                           @Override public void run(){
                               InputMethodManager keyboard=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
                               keyboard.showSoftInput(ettext,0);
                           }
                       }
            ,200);
}
 
Example 4
Source File: AddOrEditContactFragment.java    From BlackList with Apache License 2.0 5 votes vote down vote up
private void setNumber(View row, String number) {
    final EditText numberEdit = (EditText) row.findViewById(R.id.edit_number);
    numberEdit.setText(number);
    if (number == null || number.isEmpty()) {
        numberEdit.postDelayed(new Runnable() {
            @Override
            public void run() {
                numberEdit.requestFocus();
            }
        }, 100);
    }
}
 
Example 5
Source File: SpinnerDialog.java    From SearchableSpinner with Apache License 2.0 5 votes vote down vote up
private void showKeyboard(final EditText ettext) {
    ettext.requestFocus();
    ettext.postDelayed(new Runnable() {
                           @Override
                           public void run() {
                               InputMethodManager keyboard = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
                               keyboard.showSoftInput(ettext, 0);
                           }
                       }
            , 200);
}
 
Example 6
Source File: SubjectBaseActivity.java    From Primary with GNU General Public License v3.0 5 votes vote down vote up
private void showSystemKeyboard(final EditText view) {
    view.postDelayed(new Runnable() {
        @Override
        public void run() {
            if (view.requestFocus()) {
                InputMethodManager imm = (InputMethodManager)
                        getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
            }
        }
    }, 100);
}
 
Example 7
Source File: ViewUtils.java    From FloatingSearchView with Apache License 2.0 5 votes vote down vote up
public static void showSoftKeyboardDelayed(final EditText editText, long delay){
    editText.postDelayed(new Runnable() {
        @Override
        public void run() {
            InputMethodManager inputMethodManager = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
        }
    }, delay);
}
 
Example 8
Source File: Utils.java    From LearningAppAndroid with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void flashError(final EditText et, String message) {
    et.setError(message);

    // reset message after 3 second delay
    et.postDelayed(new Runnable() {
        public void run() {
            et.setError(null);
        }
    }, 3000);

}
 
Example 9
Source File: ViewUtils.java    From FloatingSearchView with Apache License 2.0 5 votes vote down vote up
public static void showSoftKeyboardDelayed(final EditText editText, long delay){
    editText.postDelayed(new Runnable() {
        @Override
        public void run() {
            InputMethodManager inputMethodManager = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
        }
    }, delay);
}