Bad value from AttributeSet.getAttributeValue()


Ask by : Droritos November 04, 2012 10:13

I have a custom SeekBarPreference, which extends DialogPreference. I'm building my own layout, yet still using the parent's attributes.

<com.example.preference.SeekBarPreference
     android:key="key"
     android:title="title"
     android:summary="summary"
     android:dialogMessage="diag message"
     android:text="text"
     android:max="60"
     android:defaultValue="30" />

In the code section, I'm retrieving the attr.getAttributeValue(androidDns, attrKey), like so

mText = attrs.getAttributeValue(androidns, "text");
mMax = attrs.getAttributeIntValue(androidns, "max", 30);
...

The thing is that in the 'mText' member I'm getting something like "@12341234" kind of text, but 'mMax' is being set right.

How is this possible ?

View original question

Answer by : vasartNovember 04, 2012 10:13

May be this helps

context.getString(attrs.getAttributeResourceValue(androidns, "text", 0));
View original answer