How do I add a custom data source to a ViewPager?
<p>I'm fairly new to Android (<em>and SO</em>) and have made a couple of apps steadily increasing in complexity. For the current project, my son (7) has a aspirations of being a palaeontologist and has asked me to digitise his dinosaur encyclopedia, so I want to have a ViewPager to swipe between the images of dinosaurs which will be clickable for further information.</p>

<p>In my other apps I have used ListViews with a custom datasource (<em>returning a ListArray</em>) so that I can use something like (<em>simplified</em>)...</p>

<p>Item Class:</p>

<pre><code>public class Item {

    private String name;

    public Item(String name) {
        this.name = name;
    }

    public  String getName() {
        return name;
    }
}
</code></pre>

<p>Adapter Class:</p>

<pre><code>public class Adapter extends ArrayAdapter&lt;Item&gt; {

    public Adapter(Context context) {
        super(context, 0);
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item, parent, false);
        }

        Item item = getItem(position);

        //Show Name
        TextView listItem_textView = (TextView) convertView.findViewById(R.id.textView);
        listItem_textView.setText(item.getName());

        return convertView;
    }
}
</code></pre>

<p>DataSource Class:</p>

<pre><code>public class DataSource {

    private List&lt;Item&gt; items;

    public DataSource() {
        items = new ArrayList&lt;&gt;();

        items.add(new Item("Name_1"));
        items.add(new Item("Name_2"));
        items.add(new Item("Name_3"));
    }

    public List&lt;Item&gt; getItems() {
        return items;
    }
}
</code></pre>

<p>...and the MainActivity class doing all the normal things like setting the adapter etc.</p>

<p>Using a ViewPager and Fragments, my current Adapter is like this:</p>

<pre><code>public class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {

        public ScreenSlidePagerAdapter(FragmentManager fragmentManager) {
            super(fragmentManager);
        }

        @Override
        public Fragment getItem(int position) {

//Something needs to go here to mirror
// Item item = getItem(position)
// so that I can use 
// Dino dino = ???

            TextView tv_name = (TextView) findViewById(R.id.tv_name);
            tv_name.setText(dino.getName());

            if(dino.getName() == null) {
                tv_name.setText("Blank");
            }

            return new ScreenSlidePageFragment();
        }

        @Override
        public int getCount() {
            return NUM_PAGES;
        }
    }
}
</code></pre>

<p>The problem - <em>I think</em> - I'm having, is that the <strong>Adapter</strong> class for my ListView extends <strong>ArrayAdapter</strong> while the current <strong>ViewPager</strong> project extends <strong>FragmentStatePagerAdapter</strong> so I have an 'Incompatible Type' error with 'Item item = getItem(position)' line.</p>

<p>The way I see it, if my understanding is correct, is that I need to get the code for the item position in with the setText() code, other than that, I'm going round in circles, so any pointers would be greatly appreciated.</p>

<p>Thanks for your time.</p>