Search code examples
androidbigdecimal

BigDecimal call requires API level 24 Android


I've been facing some issues with my calculator where I'm using double values. However when I use 2.3 (Who's binary representation is recurring ) * 3 , instead of 6.9 it would give me 6.8999999999.

So i tried to find out how to solve this and i came across big decimal numbers. However whenever i try to call

new BigDecimal(leftValue);

it always throws an error saying Call requires API level 24. But i don't see anywhere even in docs that min. API level is 24.

Can any one help me with this issue?


Solution

  • Import this:

    java.math.BigDecimal (Added in API 1)

    instead of this:

    android.icu.math.BigDecimal(Added in API 24)