List of usage examples for android.widget EditText getText
@Override
public Editable getText()
From source file:Main.java
public static boolean mobileNumberValidation(EditText editText, Pattern pattern) { if (nonEmpty(editText)) { String mobileNumber = removeBlankSpace(editText.getText().toString()); return pattern.matcher(mobileNumber).matches(); } else {// w ww.j a v a2 s . c o m return NO; } }
From source file:Main.java
public static boolean isSame(EditText paramEditText1, EditText paramEditText2) { if ((paramEditText1 == null) || (paramEditText2 == null)) { throw new NullPointerException("EditText can't null"); }/*from w ww.j a va2 s. c o m*/ return isSame(paramEditText1.getText().toString(), paramEditText2.getText().toString()); }
From source file:Main.java
public static void locateCursur(final EditText text) { if (text == null) { return;//from w ww . j av a2 s .c o m } new Handler().postDelayed(new Runnable() { @Override public void run() { Editable b = text.getText(); text.setSelection(b.length()); } }, 100); }
From source file:Main.java
public static void openKeyboard(final Context context, final EditText editText) { new Handler().postDelayed(new Runnable() { @Override//from w ww . j av a 2 s. c o m public void run() { editText.requestFocus(); editText.setSelection(editText.getText().toString().length()); InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editText, InputMethodManager.SHOW_FORCED); } }, 300); }
From source file:Main.java
public static boolean mobileNumberValidation(EditText editText, int minLength, int maxLength) { if (minLength > 0 && maxLength > 0 && nonEmpty(editText)) { String mobileNumber = removeBlankSpace(editText.getText().toString().trim()); return mobileNumber.length() >= minLength && mobileNumber.length() <= maxLength; } else {// w ww . ja v a 2 s . c o m return NO; } }
From source file:Main.java
public static boolean EmailValidation(EditText email) { String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; Pattern pattern = Pattern.compile(EMAIL_PATTERN); Matcher matcher;//from w w w . j av a 2s. c om matcher = pattern.matcher(email.getText().toString()); return matcher.matches(); }
From source file:com.madgag.agit.CloneLauncherActivity.java
private static void setCursorToEnd(EditText editText) { editText.setSelection(editText.getText().length()); }
From source file:com.wellsandwhistles.android.redditsp.common.DialogUtils.java
public static void showSearchDialog(Context context, int titleRes, final OnSearchListener listener) { final AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context); final EditText editText = (EditText) LayoutInflater.from(context).inflate(R.layout.dialog_editbox, null); alertBuilder.setView(editText);//w ww. java2 s . co m alertBuilder.setTitle(titleRes); alertBuilder.setPositiveButton(R.string.action_search, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final String query = General.asciiLowercase(editText.getText().toString()).trim(); if (StringUtils.isEmpty(query)) { listener.onSearch(null); } else { listener.onSearch(query); } } }); alertBuilder.setNegativeButton(R.string.dialog_cancel, null); final AlertDialog alertDialog = alertBuilder.create(); alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); alertDialog.show(); }
From source file:com.fsck.k9.helper.Utility.java
public static boolean domainFieldValid(EditText view) { return view != null && view.getText() != null && domainFieldValid(view.getText().toString()); }
From source file:edu.umich.flowfence.testapp.PerfActivity.java
public static int getClampedSandboxCount(EditText text) { int count = Integer.parseInt(text.getText().toString()); return Math.max(0, Math.min(count, FlowfenceConstants.NUM_SANDBOXES)); }