[Java for Android App Development] mikrosmile:
Add HTC Sense Skin support.

In AndroidManifest add this line inside <application tag and before first <activity tag where you have your MainActivity

<application
[COLOR="Red"]allowSkinChange="true"[/COLOR]
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.yourpackage.name.MainActivity"

There will be Error in Manifest, says "Attribute is missing the Android namespace prefix"

It is fine, to fix it go to - Project -> Clean; Choose your Application and click Ok​

Add reference library to use full HTC app experience

Sense 6

Download this package - View attachment 2697794

Place the extracted folder to <location of android SDK>\android\sdk\add-ons\

Choose HTC OpenSense SDK 19 when you start building your application. Profit

Sense 5 and below

Refer to this, thanks to Jonny

Make sure HTCExtension lib is appear in your Eclipse project​

Use HTCPreference Activity

Htc Preference is the same as normal Preference but you need to follow some rules when you want to have this.

First in your Preference activity (for example you already have one) change PreferenceActivity to HtcPreferenceActivity.

import com.htc.preference.*;

In prefs.xml (or any other xml file you have your preferences in) make sure everything is using this way

This is original android way.

<PreferenceScreen> </PreferenceScreen>

This is Htc way

<com.htc.preference.HtcPreferenceScreen> </com.htc.preference.HtcPreferenceScreen>

So basically to every single item in preferences you need to add com.htc.preference.Htc****

Here is prefs.xml example

<?xml version="1.0" encoding="utf-8"?>
<[COLOR="Red"]com.htc.preference.Htc[/COLOR]PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<[COLOR="red"]com.htc.preference.Htc[/COLOR]CheckBoxPreference
android:title="@string/load_icons"
android:summary="@string/load_icons_summary"
android:defaultValue="true"
android:key="show_dialog">
</[COLOR="red"]com.htc.preference.Htc[/COLOR]CheckBoxPreference>
<[COLOR="red"]com.htc.preference.Htc[/COLOR]SwitchPreference
android:title="@string/load_skins"
android:summary="@string/load_skins_summary"
android:switchTextOn="@string/on"
android:switchTextOff="@string/off"
android:defaultValue="true"
android:key="skins_on_start">
</[COLOR="red"]com.htc.preference.Htc[/COLOR]SwitchPreference>

</[COLOR="red"]com.htc.preference.Htc[/COLOR]PreferenceScreen>

This is how Pref activity should be

package com.yourpackage.name;

import android.os.Bundle;
import android.view.View;

import com.htc.widget.ActionBarContainer;
import com.htc.widget.ActionBarExt;
import com.htc.widget.ActionBarText;
[COLOR="red"]import com.htc.preference.*;[/COLOR]

public class Settings extends [COLOR="red"]Htc[/COLOR]PreferenceActivity {
private ActionBarExt actionBarExt=null;
private ActionBarText actionBarText=null;
private ActionBarContainer actionBarContainer=null;

private void SetupActionBar() {
actionBarExt=new ActionBarExt(this,getActionBar());
actionBarExt.enableHTCLandscape(false);
actionBarContainer=actionBarExt.getCustomContainer();
actionBarText=new ActionBarText(this);
actionBarText.setPrimaryText(R.string.settings);
actionBarContainer.addCenterView(actionBarText);
actionBarContainer.setRightDividerEnabled(true);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.prefs);
}

SetupActionBar();
}

}

If you cannot import com.htc.preference.*; (Eclipse will give you error) it means you dont have HtcExtension lib. Make sure you added it before doing this.

​