How to create tabs with different listview items using viewpager
<p>I have created a test sample viewpager tabs similar to android market. But all the tabs are displaying the same listView items. I need to implement in such a way that each tab has its own set of items in listView.</p>

<p>Here is my MainActivity.</p>

<pre><code>package com.example.viewpagesample;

import java.util.ArrayList;
import java.util.List;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.viewpagerindicator.TitlePageIndicator;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

public class MainActivity extends SherlockFragmentActivity {
    private ViewPager mPager;
    private TitlePageIndicator mIndicator;
    private MainPagerAdapter mAdapter;
    private List&lt;Fragment&gt; mFragments;

    private static final String FRAGMENT1 = Fragment1.class.getName();
    private static final String FRAGMENT2 = Fragment1.class.getName();
    private static final String FRAGMENT3 = Fragment1.class.getName();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // add fragments
        mFragments = new ArrayList&lt;Fragment&gt;();
        mFragments.add(Fragment.instantiate(this, FRAGMENT1));
        mFragments.add(Fragment.instantiate(this, FRAGMENT2));
        mFragments.add(Fragment.instantiate(this, FRAGMENT3));

        // adapter
        mAdapter = new MainPagerAdapter(getSupportFragmentManager(), mFragments);

        // pager
        mPager = (ViewPager) findViewById(R.id.view_pager);
        mPager.setAdapter(mAdapter);

        // indicator
        mIndicator = (TitlePageIndicator) findViewById(R.id.title_indicator);
        mIndicator.setViewPager(mPager);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        return true;
    }

}
</code></pre>

<p>Fragment1 class:</p>

<pre><code>package com.example.viewpagesample;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.actionbarsherlock.app.SherlockFragment;

public class Fragment1 extends SherlockFragment {
    private ListView mList;

    @Override
    public View onCreateView(LayoutInflater inf, ViewGroup grp, Bundle icicle) {
        View v = inf.inflate(R.layout.f_fragment1, grp, false);
        mList = (ListView) v.findViewById(R.id.listView1);
        return v;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(
                getActivity(), android.R.layout.simple_list_item_1, Cheese.STRINGS);
        mList.setAdapter(adapter);
    }

}
</code></pre>

<p>Cheese.STRINGS is just an array of strings.</p>

<p>Fragment2 class:</p>

<pre><code>package com.example.viewpagesample;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.actionbarsherlock.app.SherlockFragment;

public class Fragment2 extends SherlockFragment {
    private ListView mList;

    @Override
    public View onCreateView(LayoutInflater inf, ViewGroup grp, Bundle icicle) {
        View v = inf.inflate(R.layout.f_fragment2, grp, false);
        mList = (ListView) v.findViewById(R.id.listView2);
        return v;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(
                getActivity(), android.R.layout.simple_list_item_1, Cheese.fragment2);
        mList.setAdapter(adapter);
    }
}
</code></pre>

<p>Here in fragment2 i am using Cheese.fragment2 as items in the listView</p>

<p>But tab2 is being diaplayed with same listView items as tab11?</p>

<p>How to get different items loaded in tab2?</p>
