Back to project page Android-Universal-Notifier.
The source code is released under:
Apache License
If you think the Android project Android-Universal-Notifier listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.mairos.universalnotifier.UI; //w w w. j av a 2 s.c om import com.mairos.universalnotifier.R; import android.app.ActionBar.Tab; import android.app.Fragment; import android.app.FragmentTransaction; import android.app.ActionBar; public class TabListener implements ActionBar.TabListener{ private Fragment fragment; // The contructor. public TabListener(Fragment fragment) { this.fragment = fragment; } // When a tab is tapped, the FragmentTransaction replaces // the content of our main layout with the specified fragment; // that's why we declared an id for the main layout. @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { ft.replace(R.id.activity_main, fragment); } // When a tab is unselected, we have to hide it from the user's view. @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { ft.remove(fragment); } // Nothing special here. Fragments already did the job. @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { } }