Add FragmentActivity in TabHost

actually I have a FragmentActivity with a Tabhost, some Fragment inside and you can slide between the different Fragment thanks to a ViewPager. With this FragmentActivity, I would like to incorporate it into a other Tabhost, and so have the one below the other.

For the moment, I have this solution :

public class TabsViewPagerFragmentActivity extends ActivityGroup {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Inflate the layout
    setContentView(R.layout.main);

    TabHost mTabHost = (TabHost)findViewById(R.id.testtabhost1);
    mTabHost.setup(getLocalActivityManager());

    TabSpec ts = mTabHost.newTabSpec("tab_test1").setIndicator("TAB1");
    ts.setContent(new Intent(this,PageGaucheFragment.class)); <--- PageGaucheFragment is the FragmentAtivity with the ViewPager that I would like to add into the TabHost

    mTabHost.addTab(ts);

    mTabHost.setCurrentTab(0);

}

It works, but ActivityGroup was deprecated :( And I don't find any other solution to solve this problem.How can I have 2 TabHost and that the second can slide between the different Fragment ? Thanks for your answer, and sorry for my English ;)

Answers


Look here: http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html

I've used it successfully.


Need Your Help

Tutorials for ASP.NET MVC3 with IoC ,Repository patterns etc

asp.net-mvc-3 dependency-injection repository-pattern autofac

I will start new project which is based on ASP.NET MVC 3 using C# and razor engine.

Adding user and password to Sql Server database

sql-server-2005

My connection string defined in Web.Config currently indicatea no user or password is needed: