Java tutorial
//package com.java2s; import android.text.TextUtils; public class Main { public static boolean validateInputNumber(String text) { boolean digitsOnly = TextUtils.isDigitsOnly(text); if (TextUtils.isEmpty(text) || !digitsOnly) { return false; } return true; } }