Well, I am just trying to run the example, so this is my main.xml:

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


This is the activity code:

public class CodeBreakerActivityMulti extends TabActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        requestWindowFeature(Window.FEATURE_NO_TITLE);  
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
WindowManager.LayoutParams.FLAG_FULLSCREEN);
        
        setContentView(R.layout.main);
        
        Intent intent = getIntent();
        createNewTab("Pl 1", intent);
        createNewTab("Pl 2", intent);
        
        getTabHost().setCurrentTab(0);
    }
    
    private void createNewTab(String name, Intent intent) {
        TabHost tabHost = getTabHost();
        Intent newIntent = new Intent().setClass(this, Aaa.class);
        newIntent.putExtras(intent);
        TabHost.TabSpec spec = tabHost.newTabSpec(name);
        spec.setIndicator(name);
        spec.setContent(intent);
        tabHost.addTab(spec);
    }
}

Aaa is a dummy activity just to get it working (it still does not work), 
below are the xml layout and the Java code:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:layout_gravity="center_horizontal|center">
    <Button
        android:id="@+id/aaa_b1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:text="Button1" />
    <Button
        android:id="@+id/aaa_b2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:text="Button2" />
</LinearLayout>

package com.rts.android.codebraker;

import android.app.Activity;
import android.os.Bundle;

public class Aaa extends Activity {
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.aaa);
    }
}

-- 
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

Reply via email to