listview item onclick into pageview in next activity
<p>I have a listview containing item apple, banana, orange ...in second screen activity
when i click on particular item on  apple it navigates to Details screen </p>

<p>here output has to appear like apple ..if i swipe page then banana and for nextswipe orage </p>

<p>apple-->banana-->orange</p>

<p>but am getting output like apple-->apple-->apple.</p>

<pre><code>  Intent detailIntent =new Intent(SecondScreen.this, Details.class);            

    startActivity(detailIntent);


    public class MyApplication extends Application {

        ArrayList&lt;String&gt; totalvalue  = new ArrayList&lt;String&gt;();

    }


    public class Details extends FragmentActivity{

        MyApplication app;
        ViewPager pager;
      MyFragmentPagerAdapter pagerAdapter;     
     public static int position ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.detail);    
        app = ((MyApplication) getApplicationContext());
        pager = (ViewPager) findViewById(R.id.pager);

        FragmentManager fm = getSupportFragmentManager();      
        pagerAdapter = new MyFragmentPagerAdapter(fm,app.totalvalue);   
          pager.setAdapter(pagerAdapter);

      }



    public static class MyFragmentPagerAdapter extends FragmentPagerAdapter {


        private static  ArrayList&lt;String&gt; temperList;



        public MyFragmentPagerAdapter(FragmentManager fm, ArrayList&lt;String&gt; totalvalue ) {
             super(fm);
             this.temperList = totalvalue;
        }


        public Fragment getItem(int position) {

            return ThingFragment.newInstance((temperList.get(position)));
        }

        @Override
        public int getCount(){

        return temperList.size();

        }

         private static class ThingFragment extends Fragment {       
                private String name1;
             static ThingFragment newInstance(String string ) {

                    ThingFragment f = new ThingFragment();
                    Bundle args = new Bundle();

            args.putString("name",temperList.get(position) );
                    f.setArguments(args);

                    return f;
                }



                @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    name1 = getArguments().getString("name");
                }

                @Override
                public View onCreateView(LayoutInflater inflater, ViewGroup container,                       Bundle savedInstanceState) {

                    View v = inflater.inflate(R.layout.myfragment_layout, container, false);
                    TextView t = (TextView)v.findViewById(R.id.prodcutt);
                    t.setText(""+ name1);
                    return v;
            }

        }

    }


    }
</code></pre>
