Creating ListView of ViewPager
<p>I am trying to create a list of <code>ViewPager</code>. I have written 2 <code>Adapter</code>- for <code>ListView</code> and another for ViewPager. However I just see an empty list <a href="https://i.stack.imgur.com/wh8yp.png" rel="nofollow noreferrer">enter image description here</a>. I tried implementing in the same way as here: 
<a href="https://stackoverflow.com/questions/14920459/placing-viewpager-as-a-row-in-listview">Placing ViewPager as a row in ListView</a>, 
<a href="https://stackoverflow.com/questions/24107433/view-pager-in-listview">View Pager in listview?</a>
Here are my layouts:</p>

<p><strong>LISTVIEW LAYOUT</strong>  </p>

<pre><code>   &lt;?xml version="1.0" encoding="utf-8"?&gt;
        &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="team14.cs442.com.dummytest.MainActivity"&gt;
        &lt;ListView
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:id="@+id/ListView"
           android:background="#e88585"&gt;    
       &lt;/ListView&gt;   
    &lt;/RelativeLayout&gt;
</code></pre>

<p><strong>PagerView:</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.v4.view.ViewPager
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/pager"
    android:longClickable="true"
    xmlns:android="http://schemas.android.com/apk/res/android"&gt;
&lt;/android.support.v4.view.ViewPager&gt;
</code></pre>

<p><strong>View-1:</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;TextView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/image01"
    android:src="@android:drawable/divider_horizontal_dark"
    android:text="Hello"
    xmlns:android="http://schemas.android.com/apk/res/android" /&gt;
</code></pre>

<p><strong>View-2:</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;TextView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/image02"
    android:src="@android:drawable/divider_horizontal_dark"
    android:text="Goodbye"
    xmlns:android="http://schemas.android.com/apk/res/android" /&gt;
</code></pre>

<p><strong>Code List Adapter:</strong></p>

<pre><code>class ListViewAdapter extends ArrayAdapter {

Context context;
int layoutId;

public ListViewAdapter(Context context, int resource) {
    super(context,R.layout.pagerview, list);
    this.context = context;
    this.layoutId = resource;

}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public int getCount() {
    return list.size();
}

@Override
public Object getItem(int position) {
    return list.get(position);
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    if(convertView==null)
    {LayoutInflater inflater = (LayoutInflater) context
            .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    convertView = inflater.inflate(R.layout.pagerview, null);}

    ViewPager viewPager = (ViewPager) convertView;
    viewPager.setAdapter(new CustomAdapter(MainActivity.this));
    return convertView;
}

}

ViewPager adapter:

public class MainActivity extends AppCompatActivity implements
        ItemFragment.OnListFragmentInteractionListener

{
    int[] layouts = {R.layout.image01, R.layout.image02};
    ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
    ListViewAdapter adapter;

    public class CustomAdapter extends PagerAdapter{

        Context mContext;

        public CustomAdapter(Context context){
            mContext = context;
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            LayoutInflater inflater = (LayoutInflater) container.getContext()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            View view = inflater.inflate(layouts[position],null);
            container.addView(view, 0);
            return view;
        }


        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View)object);
        }

        @Override
        public int getCount() {
            return 2;
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public void notifyDataSetChanged() {
            super.notifyDataSetChanged();
        }

        @Override
        public void finishUpdate(ViewGroup container) {
            super.finishUpdate(container);
            adapter.notifyDataSetChanged();

        }
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        list.add("A");
        list.add("B");
        list.add("C");
        list.add("D");
        list.add("E");

        ListView listView = (ListView) findViewById(R.id.ListView);
        adapter = new ListViewAdapter(this, R.layout.pagerview);
        listView.setAdapter(adapter);
        adapter.notifyDataSetChanged();
    }
}
</code></pre>

<p>What am I missing here?</p>