Setting textColor from a Theme fails only on HTC Desire HD?

This fragment isn't necessary.. the theme should take effect without explicitly specifying the style in your layout anywhere android:textColor="?textColor.

This fragment isn't necessary.. the theme should take effect without explicitly specifying the style in your layout anywhere. Android:textColor="?textColor.

Thanks for your response Jim! It didn't work I'm afraid tho. If I remove that line, the text goes back to the default color.

If I remember correctly from when I wrote this a few months back, it needs to declare "? TextColor" to ensure it uses the Theme for the text color. And of course, it works fine on all devices I've tried it on (if I keep this fragment in).

I wonder if I've set things up differently to how you imagine? Any other ideas? Thanks.

– Andy A Apr 7 at 13:41 (In the above comment, I meant to say that the original code works fine in all other devices I've tried it on). – Andy A Apr 8 at 9:24 Bump. This is still an issue.

Does anyone have any more advice? Thanks. – Andy A Apr 11 at 9:38 This issue has still not been resolved.

Has anyone come across this too? – Andy A Jun 28 at 10:30 I think We hit the same problem - I have a report that one of our apps is crashing on HTC Desire HD and we use themable textColor as well (though we use style="@style/OurTheme").. I guess you have not yet found solution? I do not have unfortunately access to the failing HD, so I cannot see the stack trace.. But I have to fix the ptoblem too ... Do you happen to have an HD that you can run my app on so that I could see the stack trace and do some more debugging?

I could send you the app built in special QA mode of (apphance. Com) so that I could debug it remotely.. – Jarek Potiuk Jun 29 at 21:56.

I have eventually opted to fix this issue by reworking some of my xml and Java files. This does not feel ideal, for it creates inconsistency within the code, and overcomplicates something which themes are there to simplify. However, to cater for HTC Desire HD users, I have succumbed to it.

If anybody can find an alternative solution, please post it here. Loosely speaking, I fixed my code by setting text colours within Java static methods such as this... public static void setTextColor(TextView tv) { if (CURRENT_THEME==TXTTOOLS_LIGHT){ tv. SetTextColor(Color.

BLACK); } else if (CURRENT_THEME==TXTTOOLS_DARK){ tv. SetTextColor(Color. WHITE); } } or by creating various styles within styles.

Xml (one for each text color), and calling the relevant one in the Java code. SimpleCursorAdapter logins; if (Theme.getTheme()==Theme. TXTTOOLS_LIGHT){ logins = new SimpleCursorAdapter(this, R.layout.

Username_row_light_theme, c, from, to); } else if (Theme.getTheme()==Theme. TXTTOOLS_DARK){ logins = new SimpleCursorAdapter(this, R.layout. Username_row_dark_theme, c, from, to); }.

I do not see it in the code you provided, so I assume if it is set, it is done there.(And that is probably the reason for the other Jim's comment - your response indicates it is not being set.) Additionally, you have defined a "textColor" attribute twice - once in themes. Xml and again in attrs.xml. How does any device know which one you are referring to?

Because you are using the "? " syntax, the system should know to look for a style attribute, but I don't think it explicitly checks the resource type. In fact, valid syntax includes the resource type, it might help to have "?

Style/textColor". Also, try calling the other one "attrTextColor" to distinguish between it and the "textColor" attributes in your theme.(Also, "textColor" seems to me like a bad attribute name because it could be confused with the attribute "android:textColor" - maybe you should name it "txtoolsTextColor" or something else. Since the system should know to look in your package for the "textColor" resource, it really shouldn't matter... except that you have a bug and this might be the cause...).

Cheers for your response! Maybe what I have not made clear is that the theme of the app is chosen by the user. Currently there is a choice of two; a light one and a dark one.

The theme is therefore not set in the manifest file, it is chosen by the user on the Preferences screen of the app, and set in Java with code such as this - activity. SetTheme(R.style. Theme_TxttoolsLight); In regards to your themes.

Xml / attrs. Xml query, the color of each theme is defined in themes. Xml, whilst attrs.

Xml is needed to declare what attributes are in a theme. Attrs. Xml doesn't define the color itself.

– Andy A Aug 8 at 8:10.

My app works fine on most devices, but crashes on HTC Desire HD, (Android 2.2.1). Exception class - android.content.res. Source method - Resources.

I am setting textColor using Themes. If I just hardcode the textColor in my xml file, it works fine, so it seems to be failing to understand that '? TextColor' should make it look at my themes.

Again, this works fine on other devices I've tested on, but fails on the HTC Desire HD. Edit: Eclipse 3.5.2 reports to me 'Unable to resolve color value "? TextColor" in attribute "textColor"' in the Graphical Layout tab of my layout.xml.

However, I can still compile and build, and it still works on all other devices other than HTC Desire HD. The full code is at the bottom of this question. Edit: 5th July 2011 I have discovered that if I use 'android:textColorPrimary' rather than 'textColor', the error no longer occurs on HTC Desire HD, but the text color will always remain the system textColor default.

On all devices, it works perfectly as expected. Edit: 6th July 2011 Early Morning Basically, HTC Desire HD seems to ignore any values set with a '?'. Despite the half-fix described in my last edit, I get errors later on in my application on pages where styles are used.

Edit: 6th July 2011 Late Afternoon I have half fixed the problem by crudely setting the text color in Java (dependent on the theme). However, this doesn't yet work for my the text in my ListView which uses a 'style'. However, I have now discovered that all of the remainder of my program works fine, despite using '?

This implies that only the opening screen fails to work, indicating that the HTC Desire HD does not create the neccesary themes or styles early enough needed to decipher '? (or something like that!) This could be crucial information! Could I swap anything around in my code to make it work?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions