Android examples for java.util.regex:Number Pattern
validate Number using Regex
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean validateNumber(String str) { Pattern pattern = Pattern.compile("[0-9]"); Matcher matcher = pattern.matcher(str); return matcher.matches(); }/* w w w . j a v a2s.c om*/ }