Hi,
It seems that the layout-editor cannot run this code successfully in our
EditTime.java implemenation:
...
TypedArray customTypedAttrs =
context.obtainStyledAttributes(attrs, R.styleable.EditTime);
(*line 279*) regularTextColor =
customTypedAttrs.getColor(R.styleable.EditTime_android_textColor,
context.getResources().getColor(R.color.text));
...
Where R.color.text is defined as a ./res/color/text.xml:
(The text_color_dis and text_color_default are defined as proper hex-values
in the ./res/values/colors.xml)
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/text_color_dis"/>
<item android:color="@color/text_color_default"/>
</selector>
And where EditTime_android_textColor is defined in attrs.xml:
...
<declare-styleable name="EditTime">
<attr name="hours" format="integer"/>
<attr name="minutes" format="integer"/>
* <attr name="android:textColor"/>*
<attr name="textColorError" format="color"/>
</declare-styleable>
...
It throws an exception with this stacktrace in the error-log:
*java.lang.NumberFormatException: Color value
'D:\mobile\android.kronosmobile.02.00\source\KronosMobile\res\color\text.xml'
must start with #*
at
com.android.layoutlib.bridge.impl.ResourceHelper.getColor(ResourceHelper.java:73)
at
com.android.layoutlib.bridge.android.BridgeResources.getColor(BridgeResources.java:178)
* at com.kronos.mobile.android.widget.EditTime.init(EditTime.java:279)*
at com.kronos.mobile.android.widget.EditTime.<init>(EditTime.java:67)
at com.kronos.mobile.android.widget.EditTime.<init>(EditTime.java:62)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
...
Is the code on line 279 wrong or is this an issue with the layout-editor
plugin? The code runs fine on the emulator or on an actual device.
Thanks!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en