How to set icon to title bar for each Activity in TabLayout
<p>In my tablayout example, i have created 3 tabs, as usually i set 3 activities for each tab. I can set image to title bar of activity, which adds the intent to each tab. Due to this, the image in the title bar is visible in all 3 tabs. My requirement is to set a different image to title bar for each activity. I followed <a href="http://stackoverflow.com/questions/3157522">this</a> to set image to title bar. But when i am going to do the same thing to each activity, getting <code>android.util.AndroidRuntimeException: You cannot combine custom titles with other title features</code> this error and application is terminated.</p>

<p>manifest.xml</p>

<pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.aptitsolution.tablayout"
  android:versionCode="1"
  android:versionName="1.0"&gt;
&lt;application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/MyTheme"&gt;
    &lt;activity android:name=".TabLayoutDemo"
              android:label="@string/app_name" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;

 &lt;activity android:name="AlbumsActivity"&gt;&lt;/activity&gt;
</code></pre>

<p>
  
</p>

<p>TabLayoutDemo.java</p>

<pre><code>public class TabLayoutDemo extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.main);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.my_title);

    Resources res = getResources(); 
    TabHost tabHost = getTabHost(); 
    TabHost.TabSpec spec;  
    Intent intent;  

    intent = new Intent().setClass(this, ArtistsActivity.class);
    spec = tabHost.newTabSpec("artists").setIndicator("Artists",
                      res.getDrawable(R.drawable.ic_tab_artists))
                  .setContent(intent);
    tabHost.addTab(spec);
    ....
    ....
</code></pre>

<p>ArtistsActivity.java</p>

<pre><code>public class ArtistsActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);//i am getting the error here     
    setContentView(R.layout.artists);
    setFeatureDrawableResource(Window.FEATURE_CUSTOM_TITLE, R.layout.my_title);     

}
</code></pre>

<p>}</p>

<p>my_title.xml</p>

<pre><code>&lt;RelativeLayout android:id="@+id/header"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_width="fill_parent"&gt;
&lt;ImageView android:src="@drawable/nowplaying"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" /&gt;

&lt;TextView android:id="@+id/title" android:layout_width="wrap_content"
    android:text="New Title" android:layout_height="wrap_content"/&gt;&lt;/RelativeLayout&gt;
</code></pre>

<p>thanks
<br>venu</p>
