They just have different cases of "everything else." They both return int for valid int and defValue for null . The difference is how they handle the case of neither one nor the other.
From link :
TypedValue v = mValue; if (getValueAt(index, v)) { Log.w(Resources.TAG, "Converting to int: " + v); return XmlUtils.convertValueToInt( v.coerceToString(), defValue); } Log.w(Resources.TAG, "getInt of bad type: 0x" + Integer.toHexString(type)); return defValue;
This is the additional information you are talking about. It seems to convert the unknown value to a string and then to an integer. This can be useful if you saved "12" or some equivalent value.
Additionally, getInteger throws an exception if it is not null , not int . In contrast, if all else fails, getInt returns a default value.
Also note that their behavior in this odd case is different from the fact that calling one above the other would be incorrect in each case. The best solution is one that meets your expectations of failure.
Guvante
source share