views:

108

answers:

3

Can I somehow detect if my app is running on HTC Sense?

More generally, the problem is, that I have a Button with custom drawable. It's something very similar to the account switcher in the top right of Gmail app. When pressed or focused, the button has orange highlight. But that doesn't look nice on HTC Sense - because the standard highlight color there is green.

+2  A: 

Lets see android.os.Build strings I am not sure what the HTC folks use a combination to indicate a HTC sense device..

Fred Grott
A: 

You could try looking for an HTC/Sense application that relies on the Rosie framework and can't be uninstalled - or maybe the Rosie framework itself being present would be enough. This thread shows how to get a list of installed applications.

Josiah
And if you go with Fred's method, you can probably find a ripped ROM on XDA Developers to pull the build string from.
Josiah
A: 

I think that Android has provided a better way for you to solve this than doing a check for Sense, and it will work for every device manufacturer. HTC isn't the only one who has changed the colors on the selectors. I think Sony Ericsson has a transparent white/blue, Motorola changed it to red in their MotoBlur UI, and Garmin-Asus changed it to blue in theirs just to name a few.

What you should do is override the android:background attribute on your image button and use a drawable of your own instead of relying on the framework's background drawable. If you're not already familiar with them, you'll probably also want to take a look at Selectors when you create your custom background, so you still get the pressed/selected/not-selected color cues.

If you have multiple buttons that you want to do this on, you may want to use styles and themes to help out with this. The two primary places you'll want to reference from the Android documentation are "Applying Styles and Themes" and "Style Resources"

Hope that helps!

John
In the question I am saying that I do use a custom drawable. The highlight color is orange which doesn't look "native" in HTC Sense. There's no easy way to solve this in Android, because every manufacturer can have its own UI style... :( All I can do is detect if I'm on Sense and set the green drawable. I know that there are other UI customization apart from Sense, but I want to deal with Sense only, because it's so widespread.
fhucho