g1bb wrote:
> I've been trying to start new activities based on a TabHost using the
> following code:
> setContentView(R.layout.main);
>
> TabHost tabs =
> (TabHost)this.findViewById(R.id.th_set_menu_tabhost);
> tabs.setup();
>
> TabSpec ts1 = tabs.newTabSpec("Page 1");
> ts1.setIndicator("p1");
> ts1.setContent(R.id.Main);
> tabs.addTab(ts1);
>
> TabSpec ts2 = tabs.newTabSpec("Page 2");
> ts2.setIndicator("p2");
> ts2.setContent(new Intent(this,
> NewActivity.class));
> tabs.addTab(ts2);
>
> But I keep getting the following error:
> 11-22 14:55:43.913: ERROR/AndroidRuntime(1231):
> java.lang.IllegalStateException:
> 11-22 14:55:43.913: ERROR/AndroidRuntime(1231): at
> android.widget.TabHost$IntentContentStrategy.getContentView
> (TabHost.java:598)
> 11-22 14:55:43.913: ERROR/AndroidRuntime(1231): at
> android.widget.TabHost.setCurrentTab(TabHost.java:310)
> 11-22 14:55:43.913: ERROR/AndroidRuntime(1231): at
> android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:126)
>
> Any ideas on this? Thanks in advance!
The error message may be accurate:
"Did you forget to call 'public void setup(LocalActivityManager
activityGroup)'?"
That's a method on TabHost -- you need to call it before adding tabs if
your Activity is not a subclass of TabActivity.
--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.4 Published!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---