Java tutorial
//package com.java2s; import android.text.method.DigitsKeyListener; import android.widget.EditText; public class Main { private static final String WORD_AND_NUM = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; public static void setDigitsWordAndNum(EditText et) { if (et != null) { et.setKeyListener(DigitsKeyListener.getInstance(WORD_AND_NUM)); } } }