Hi,

I am trying like this,


public class SampleTab extends Activity implements
TabHost.TabContentFactory {

        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                TabHost tabHost = new TabHost(this);
                tabHost.setup();
                tabHost.addTab(tabHost.newTabSpec("Tab1").setIndicator("Tab1")
                                .setContent(this));
                tabHost.addTab(tabHost.newTabSpec("Tab2").setIndicator("Tab2")
                                .setContent(this));
                setContentView(tabHost);
        }

        public View createTabContent(String tag) {
                TextView tv = new TextView(this);
                tv.setText("This is from : " + tag);
                return tv;
        }
}

I dont want to create TabHost in XML, I am using only java code. Is it
because of that, I am getting the exception, "Your TabHost must have a
TabWidget whose id attribute is
'android.R.id.tabs'"

Nithin



-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to