Android examples for java.lang:Integer
Convert Object to integer
import android.content.Context; import java.text.DecimalFormat; public class Main{ public static boolean num(Object o) { int n = 0; try {//from ww w. ja v a 2s. c om n = Integer.parseInt(o.toString().trim()); } catch (NumberFormatException e) { e.printStackTrace(); } if (n > 0) { return true; } else { return false; } } }