Reputation: 2567
I've declared two integer resources as such:
<resources>
<integer name="COLUMNS">5</integer>
<integer name="ROWS">4</integer>
</resources>
When I try to calculate the resulting number of cells (0 based) like this:
R.integer.COLUMNS * R.integer.ROWS-1
I get the warning Numeric overflow in expression
Can anyone explain to me why this warning occurs and if its valid or even dangerous (crash, buffer overflow etc.)?
Android Studio 3.3 Build #AI-182.5107.16.33.5199772, built on December 25, 2018 JRE: 1.8.0_152-release-1248-b01 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0
Upvotes: 0
Views: 101
Reputation: 164139
R.integer.COLUMNS
is the integer id of the resource and not the value of the resource.
You can get the value of the resource with:
getResources().getInteger(R.integer.COLUMNS)
Upvotes: 1