Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid listview on item click into page viewer in next screen and swipe
    primarykey
    data
    text
    <p>I have a <code>listview</code> contain items Apple, Banana, Orange ...in second screen <code>activity</code> when I click on particular item on Apple it navigates to Details screen </p> <p>here output has to appear like by clicking on --> Apple ..if I swipe page then banana and for next swipe Orange </p> <p>Apple-->Banana-->Orange</p> <p>If I click on Banana -->then it has to appear like Banana then left swipe Apple ..and for right swipe...Orange.</p> <p>So which item I clicked on(Banana) <code>listview</code> in second screen it has to appear on details screen and for left swipe previous list item and for right swipe next item in the list.</p> <p>Banana-->for left swipe Apple -->for right swipe Orange </p> <p>If I click on Orange -->then it has to appear like Orange then left swipe Banana ..and for next left swipe...Orange. Banana</p> <p>Orange-->for left swipe Banana--->for next left swipe-->Apple</p> <p>but am getting output like Apple-->Banana-->Orange for all the cases of each item clicked on the <code>listview</code>....</p> <pre><code>public class SecondScreen extends Activity { ListView listView; LayoutInflater lay; MyApplication app; protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.second); app = ((MyApplication) getApplicationContext()); listView = (ListView) findViewById(R.id.yearlistss); listView.setAdapter(new MyAdapter(SecondScreen.this,app.totalvalue)); listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, final int arg2, long arg3) { Intent detailIntent =new Intent(SecondScreen.this, Details.class); startActivity(detailIntent); } }); } public class MyAdapter extends BaseAdapter { Context context = null; private ArrayList&lt;String&gt; temperList1; public MyAdapter(SecondScreen secondScreen, ArrayList&lt;String&gt; totalvalue) { this.temperList1 = totalvalue; } public int getCount() { // TODO Auto-generated method stub return temperList.size(); } public Object getItem(int position) { // TODO Auto-generated method stub return temperList; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub View layout = null; TextView totalval = null; if (convertView == null) { lay = LayoutInflater.from(getApplicationContext()); layout = lay.inflate(R.layout.secondlist, null); totalval = (TextView) layout.findViewById(R.id.total); } else { layout = convertView; } totalval.setText("" + temperList1.get(position)); return layout; } } } 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 final 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",string ); 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>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload