Георг Мосин Георг Мосин - 3 months ago 27
Android Question

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.

Answer

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...