views:

18

answers:

1

I have 4 tabs, in my application which is been developed in android. I wanted to know which event is fired when i navigate from one tab to another.

@Matthew Vines *Where should i use this event in my code, as i am a fresher with android*

public class Test extends TabActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TabHost host = getTabHost();
host.addTab(host.newTabSpec("Test1").setIndicator(new MyView(this, R.drawable.icon, "Test1")).setContent(new Intent(this, Test1.class)));
host.addTab(host.newTabSpec("Test2").setIndicator(new MyView(this,
R.drawable.compass, "Test2")).setContent(new Intent(this, Test2.class))); host.addTab(host.newTabSpec("Test3").setIndicator(new MyView(this,
R.drawable.mosquebg, "Test3")).setContent(new Intent(this, Test3.class)));

            host.addTab(host.newTabSpec("Settings").setIndicator(new MyView(this,  
            R.drawable.icon, "Settings")).setContent(new Intent(this, Settings.class)));

            host.getTabWidget().setBackgroundResource(R.drawable.background);


            host.getTabWidget().getChildAt(0).getLayoutParams().height=35;
            host.getTabWidget().getChildAt(1).getLayoutParams().height=35;
            host.getTabWidget().getChildAt(2).getLayoutParams().height=35;
            host.getTabWidget().getChildAt(3).getLayoutParams().height=35;

}

}

+1  A: 

setOnTabChangedListener is the listener you would set up for the OnTabChanged event.

Matthew Vines