Get integer value from dimens.xml resource file in Android
You dont need a TypedValue
use the following
(int) this.getResources().getDimension(R.integer.quantity_length)
;
Why not store the integer in res/integers.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="quantity_length">12</integer>
</resources>
And to access the values in code
int myInteger = getResources().getInteger(R.integer.quantity_length);
Or in XML
android:maxLength="@integer/quantity_length"
int max = getContext().getResources().getInteger(R.integer.quantity_length);
With your example, why don't you use this method?
XML
<integer name="quantity_length">10</integer>
JAVA
getResources().getInteger(R.integer.quantity_length);