Android examples for java.util.regex:Number Pattern
is String Valid Integer with regular expression
import android.annotation.SuppressLint; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Hashtable; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static boolean isValidInteger(String str) { if (null == str) { return false; }/* w ww . ja va 2 s . c o m*/ Pattern p = Pattern.compile("^\\d*$"); Matcher match = p.matcher(str); return match.matches(); } }