An Exception occur in Tablayout.

Posted by Kooper on Stack Overflow See other posts from Stack Overflow or by Kooper
Published on 2010-06-12T18:11:09Z Indexed on 2010/06/12 18:32 UTC
Read the original article Hit count: 180

Filed under:

I wanna add three layout in a TabActivity, but it was force closed when I ran it.

Here is the code:

import android.app.TabActivity; import android.content.res.Resources; import android.os.Bundle; import android.widget.TabHost;

public class Test1 extends TabActivity {

public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
     Resources res = getResources(); 
     TabHost tabHost = getTabHost();      

    tabHost.addTab(tabHost.newTabSpec("egcquery").setIndicator("EGCQuery").setContent(R.layout.main1)); 
    tabHost.addTab(tabHost.newTabSpec("PatientInfo").setIndicator("PatientInfo").setContent(R.layout.main2)); 
    tabHost.addTab(tabHost.newTabSpec("Comp_Interp").setIndicator("Comp_Interp").setContent(R.layout.main3));
}

}

© Stack Overflow or respective owner

Related posts about android