Android examples for android.text:InputFilter
create Alpha Numeric Input Filter
//package com.java2s; import android.text.InputFilter; import android.text.Spanned; public class Main { public static InputFilter[] createAlphaNumericInputFilter() { InputFilter inputFilter = new InputFilter() { @Override//from www . j a v a 2s . c o m public CharSequence filter(CharSequence source, // int start, int end, Spanned dest, int dstart, int dend) { if (source.toString().matches("^[0-9a-zA-Z]+$")) { return source; } else { return ""; } } }; return new InputFilter[] { inputFilter }; } }