Search code examples
javaandroidbigdecimalandroid-api-levels

BigDecimal in android api 16


I'm new to Android so please, explain me, how to use BigDecimal in API level 16, because using this line:

BigDecimal currentNumber = new BigDecimal(String "0.0");

results in an error, Call requires api level 24.


Solution

  • you are constructing the object wrong... BigDecimal is available since API1

    you need to do:

    BigDecimal currentNumber = new BigDecimal("0.0");
    

    Note that I removed the unnecessary String Class just pass the value between quotes...