OK, here is a way to implement what I was looking to do. I initially took this from http://geekyouup.blogspot.com/2011/07/viewpager-example-from-paug.html but I wanted to add more than one textView to the scrolling list.
I was struggling at first to include more than the one text view
which is shown in the demo at this site but it was because of then Casting to TextView in the destroyItem and initemfromObject methods. I'm going to be writing a PagerCurrsor adapter for sqlite so I'll post it here when I get it working.
Another thing to note is that position is incremented as the user swipes through the list so you would use that to iterate through an array or a cursor.
Hope this helps other developers and thanks for all the answers posted.
Overidden methods:
public Object instantiateItem(View collection, int position) {
layout = inflater.inflate(R.layout.scrolllayout, null);
TextView tv = (TextView) layout.findViewById(R.id.textView1);
tv.setText("1________________>" + position);
TextView tv2 = (TextView) layout.findViewById(R.id.textView2);
tv.setText("2________________>" + position);
((ViewPager) collection).addView(layout);
return layout;
}
@Override
public void destroyItem(View collection, int position, Object view) {
((ViewPager) collection).removeView((View)view);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view==((View)object);
}
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id= "@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" android:orientation="vertical">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView1" android:id="@+id/textView1"></TextView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView2" android:id="@+id/textView2"></TextView>
</LinearLayout>
[1]http://geekyouup.blogspot.com/2011/07/viewpager-example-from-paug.html