Cannot load tab activity via activity group
<p>I'm trying to load an activity into a tab via an activity group but the activity isn't loading which culminates in an illegalStateException error: </p>

<p>Here is a copy of the Log information:</p>

<pre><code>01-10 11:01:06.201: INFO/WeatherClockWidgetProvider(582): updateTime
01-10 11:01:06.201: INFO/WeatherClockWidgetProvider(582): setCalendarInstance
01-10 11:01:06.211: INFO/WeatherClockWidgetProvider(582): onTimeChanged
01-10 11:01:06.211: INFO/WeatherClockWidgetProvider(582): mHour01HandIndex = 1
01-10 11:01:06.211: INFO/WeatherClockWidgetProvider(582): mHour01HandIndex = 1
01-10 11:01:06.211: INFO/WeatherClockWidgetProvider(582): mHour01HandIndex = 0
01-10 11:01:06.211: INFO/WeatherClockWidgetProvider(582): mHour01HandIndex = 1
01-10 11:01:06.211: INFO/WeatherClockWidgetProvider(582): updateTime id = 3
01-10 11:01:06.211: INFO/WeatherClockWidgetProvider(582): updateCurrentTemperature
01-10 11:01:06.221: INFO/WeatherClockWidgetProvider(582): changeFtoC
01-10 11:01:06.251: INFO/WeatherClockWidgetProvider(582): updateCurrentLocal
01-10 11:01:06.281: INFO/WeatherClockWidgetProvider(582): updateTemperatures
01-10 11:01:06.281: INFO/WeatherClockWidgetProvider(582): setCalendarInstance
01-10 11:01:06.291: INFO/WeatherClockWidgetProvider(582): highT = 48
01-10 11:01:06.291: INFO/WeatherClockWidgetProvider(582): lowT = 43
01-10 11:01:06.291: INFO/WeatherClockWidgetProvider(582): changeFtoC
01-10 11:01:06.301: INFO/System.out(8418): waiting for debugger to settle...
01-10 11:01:06.301: INFO/WeatherClockWidgetProvider(582): changeFtoC
01-10 11:01:06.311: INFO/WeatherClockWidgetProvider(582): updateDate
01-10 11:01:06.311: INFO/WeatherClockWidgetProvider(582): setCalendarInstance
01-10 11:01:06.311: INFO/WeatherClockWidgetProvider(582): updateWeatherDescription
01-10 11:01:06.321: INFO/WeatherClockWidgetProvider(582): updateUpdatedTime
01-10 11:01:06.321: INFO/WeatherClockWidgetProvider(582): setCalendarInstance
01-10 11:01:06.341: ERROR/updateUpdatedTime dateString(582): 1/10/2012
01-10 11:01:06.371: ERROR/updatedTime before(582):  Update: JAN.10 9:10 AM
01-10 11:01:06.371: ERROR/updatedTime end(582):  Update: JAN.10 9:10 AM
01-10 11:01:06.441: INFO/WeatherClockWidgetProvider(582): bindViews
01-10 11:01:06.441: INFO/WeatherClockWidgetProvider(582): appWidgetId = 3
01-10 11:01:06.501: INFO/System.out(8418): waiting for debugger to settle...
01-10 11:01:06.701: INFO/System.out(8418): waiting for debugger to settle...
01-10 11:01:06.909: INFO/System.out(8418): waiting for debugger to settle...
01-10 11:01:07.110: INFO/System.out(8418): waiting for debugger to settle...
01-10 11:01:07.311: INFO/System.out(8418): debugger has settled (1316)
01-10 11:01:07.501: ERROR/gralloc(126): [unregister] handle 0x6335d0 still locked (state=40000001)
01-10 11:01:08.931: INFO/ActivityManager(126): Displayed activity com.PecAppsRadio/.tabs: 4886 ms (total 4886 ms)
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): updateAllElements
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): updateTime
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): setCalendarInstance
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): onTimeChanged
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): mHour01HandIndex = 1
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): mHour01HandIndex = 1
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): mHour01HandIndex = 0
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): mHour01HandIndex = 2
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): updateTime id = 3
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): updateCurrentTemperature
01-10 11:02:00.091: INFO/WeatherClockWidgetProvider(582): changeFtoC
01-10 11:02:00.111: INFO/WeatherClockWidgetProvider(582): updateCurrentLocal
01-10 11:02:00.111: INFO/WeatherClockWidgetProvider(582): updateTemperatures
01-10 11:02:00.121: INFO/WeatherClockWidgetProvider(582): setCalendarInstance
01-10 11:02:00.131: INFO/WeatherClockWidgetProvider(582): highT = 48
01-10 11:02:00.131: INFO/WeatherClockWidgetProvider(582): lowT = 43
01-10 11:02:00.131: INFO/WeatherClockWidgetProvider(582): changeFtoC
01-10 11:02:00.141: INFO/WeatherClockWidgetProvider(582): changeFtoC
01-10 11:02:00.151: INFO/WeatherClockWidgetProvider(582): updateDate
01-10 11:02:00.151: INFO/WeatherClockWidgetProvider(582): setCalendarInstance
01-10 11:02:00.161: INFO/WeatherClockWidgetProvider(582): updateWeatherDescription
01-10 11:02:00.161: INFO/WeatherClockWidgetProvider(582): updateUpdatedTime
01-10 11:02:00.161: INFO/WeatherClockWidgetProvider(582): setCalendarInstance
01-10 11:02:00.171: ERROR/updateUpdatedTime dateString(582): 1/10/2012
01-10 11:02:00.171: ERROR/updatedTime before(582):  Update: JAN.10 9:10 AM
01-10 11:02:00.171: ERROR/updatedTime end(582):  Update: JAN.10 9:10 AM
01-10 11:02:00.201: INFO/WeatherClockWidgetProvider(582): bindViews
01-10 11:02:00.201: INFO/WeatherClockWidgetProvider(582): appWidgetId = 3
</code></pre>

<p>java code which reads the xml file containing the tabhost and tabwidget controls: </p>

<pre><code>    public class tabs extends Activity{


        protected void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);
            setContentView(R.layout.tabmain);

            TabHost tabs=(TabHost)findViewById(R.id.tabhost);

            tabs.setup();

            TabHost.TabSpec spec=tabs.newTabSpec("tag1");    
            spec.setContent(R.id.tab1);
            spec.setIndicator("tab1");
            tabs.addTab(spec);

            spec=tabs.newTabSpec("tag2");
            spec.setContent(R.id.tab2);
            spec.setIndicator("tab2");
            tabs.addTab(spec);

            spec=tabs.newTabSpec("tag3");
            spec.setIndicator("Favourites", getResources().getDrawable(R.drawable.favourites_star));
            spec.setContent(new Intent(this,RadioAppActivityGroup.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
            tabs.addTab(spec);

        }


    private class RadioAppActivityGroup extends ActivityGroup{


        protected void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);

            View view = getLocalActivityManager().startActivity("radiotabs", new
            Intent(this, favourites.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();

            this.setContentView(view);


        }   



   }


}
</code></pre>

<p>xml code containg the tabhost and layout controls: </p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/tabhost"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  &lt;LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"&gt;
    &lt;TabWidget android:id="@android:id/tabs"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
    /&gt;
    &lt;FrameLayout android:id="@android:id/tabcontent"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;

       &lt;LinearLayout 
      android:id="@+id/tab1"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"/&gt;

       &lt;LinearLayout 
      android:id="@+id/tab2"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"/&gt;

      &lt;LinearLayout 
      android:id="@+id/tab3"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"/&gt;

    &lt;/FrameLayout&gt;
  &lt;/LinearLayout&gt;
&lt;/TabHost&gt;
</code></pre>
