I have an EditText which is decimal and I set its length using android:maxLength property in xml:
You dont need a TypedValue use the following
TypedValue
(int) this.getResources().getDimension(R.integer.quantity_length);
(int) this.getResources().getDimension(R.integer.quantity_length)