tags:

views:

53

answers:

0

Hi,

I am new to this platform and already starting to love it. I am work on a UI for a project which uses the tabhost to display two separate activities using a TabActivity class. This works ok. Now i would like to add a viewflipper to the equation. I am trying to add the tabhost widget to the viewflipper using the addView() method. Eg:

public class Main extends TabActivity { 
        @Override 
        public void onCreate(Bundle savedInstanceState) { 
                super.onCreate(savedInstanceState); 
                TabHost host = getTabHost(); 
                host.addTab(host.newTabSpec("one").setIndicator("First").setContent( 
                                new Intent(this, First.class))); 
                host.addTab(host.newTabSpec("two").setIndicator("Second") 
                                .setContent(new Intent(this, Second.class))); 
               Button btn1 = new Button(this); 
               btn1.setText("Second Screen"); 
               flipper = new ViewFlipper(this); 
               flipper.addView(host); 
               flipper.addView(btn1); 
               setContentView(flipper); 
        } 
} 

The main motive is to an application with two activities all tabbed. The viewflipper will then flip between these two activities. I am thinking an alternative will be to use xml layout to hold the tabhost and just include it in the view. I am avoiding it for now because that would mean me writing the codes for the two classes again. To round all this up, is there a way to include a tabhost in a viewflipper.

Thanks,

New Guy