Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is an example:</p> <p>MainActivity:</p> <pre><code>public class MainActivity extends Activity { /** Called when the activity is first created. */ private Context mContext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; setContentView(R.layout.main); ListView listview1 = new ListView(mContext); ListView listview2 = new ListView(mContext); ListView listview3 = new ListView(mContext); Vector&lt;View&gt; pages = new Vector&lt;View&gt;(); pages.add(listview1); pages.add(listview2); pages.add(listview3); ViewPager vp = (ViewPager) findViewById(R.id.viewpager); CustomPagerAdapter adapter = new CustomPagerAdapter(mContext,pages); vp.setAdapter(adapter); listview1.setAdapter(new ArrayAdapter&lt;String&gt;(mContext, android.R.layout.simple_list_item_1,new String[]{"A1","B1","C1","D1"})); listview2.setAdapter(new ArrayAdapter&lt;String&gt;(mContext, android.R.layout.simple_list_item_1,new String[]{"A2","B2","C2","D2"})); listview3.setAdapter(new ArrayAdapter&lt;String&gt;(mContext, android.R.layout.simple_list_item_1,new String[]{"A3","B3","C3","D3"})); } } </code></pre> <p>CustomViewPagerAdapter.java</p> <pre><code>public class CustomPagerAdapter extends PagerAdapter { private Context mContext; private Vector&lt;View&gt; pages; public CustomPagerAdapter(Context context, Vector&lt;View&gt; pages) { this.mContext=context; this.pages=pages; } @Override public Object instantiateItem(ViewGroup container, int position) { View page = pages.get(position); container.addView(page); return page; } @Override public int getCount() { return pages.size(); } @Override public boolean isViewFromObject(View view, Object object) { return view.equals(object); } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } } </code></pre> <p>For more information check my blog. <a href="http://android-java-development.blogspot.pt/2012/05/system.html" rel="nofollow">Here</a>.</p>
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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