Convert Object to double - Android java.lang

Android examples for java.lang:Double

Description

Convert Object to double

Demo Code

public static boolean decimal(Object o) {
    double n = 0;
    try {/*from  ww w . j av a  2 s  .  c o  m*/
        n = Double.parseDouble(o.toString().trim());
    } catch (NumberFormatException e) {
        e.printStackTrace();
    }
    if (n > 0.0) {
        return true;
    } else {
        return false;
    }
}

Related Tutorials