Back to project page Implementing-ActionBarSherlock-Fragment-Tabs-in-Android.
The source code is released under:
Apache License
If you think the Android project Implementing-ActionBarSherlock-Fragment-Tabs-in-Android 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.example.sherlockfragmenttabs; /*from w ww . ja v a 2 s .c om*/ import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar.Tab; import com.actionbarsherlock.app.SherlockFragment; public class FragmentsTab2 extends SherlockFragment implements ActionBar.TabListener { private Fragment mFragment; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from fragment2.xml getActivity().setContentView(R.layout.fragment2); } public void onTabSelected(Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub mFragment = new FragmentsTab2(); // Attach fragment2.xml layout ft.add(android.R.id.content, mFragment); ft.attach(mFragment); } public void onTabUnselected(Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub // Remove fragment2.xml layout ft.remove(mFragment); } public void onTabReselected(Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub } }