title: How to build a viewpager that acts infinite and detects which side it was swiped?
body: <p>I understand that a viewpager can be used, but I am having a hard time finding a good resource explaining how to use a viewpager with the following additions.</p>
  
  <p>The view to record if the swipe was left or right, and either way just reload a new content (if left I want it to record no, right for it to record yes).</p>
  
  <p>I want it to be infinite or really large, like 10000.</p>
  
  <p>Finally, be able to add buttons underneath it as well.</p>
  
  <p>In summary any direction, tutorials, or examples would be appreciated.</p>
  
  <ul>
  <li><em>no tabs</em> - just avoided implementing a tab listener and including tabs when creating the view pager</li>
  <li>read swipes </li>
  <li>load new content </li>
  <li>infinite or really large</li>
  <li><em>have buttons underneath it</em> - done by including it in the drawer layout</li>
  </ul>
  
  <p>Hopefully this clears things up:</p>
  
  <p>UPDATE: 
   Here is the scenario I am trying to read swipes - if left record no and if right record yes, then grab new content from cache and display it, with the same two swipe options, I was thinking maybe I can just have 3 "pages" and swiping left records the action then it resets to position (middle - 1) and then loads the next content available in the cache... the only thing is I do not know how to call the reset and ask for a refresh of the content...</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>No tabs has been solved by just adding the code like so:</p>
  
  <pre><code>//viewpager adapter
      private PageAdapter mAdapter;
      private ViewPager viewPager;
  
  
  // Initializing pager - in On Create
          viewPager = (ViewPager) findViewById(R.id.random_pager);
          FragmentManager fm = getFragmentManager();
          mAdapter = new PageAdapter(getSupportFragmentManager(), new UserCreatedFragment(), new UserUpVotesFragment(),new UserDownVotesFragment());
          viewPager.setAdapter(mAdapter);
          // Here you would declare which page to visit on creation
          viewPager.setCurrentItem(1);
  </code></pre>
  
  <p>This is the adapter:</p>
  
  <pre><code>public class PageAdapter extends FragmentPagerAdapter{
      private Fragment frag1;
      private Fragment frag2;
      private Fragment frag3;
  
      public PageAdapter(FragmentManager fm, Fragment frag1, Fragment frag2, Fragment frag3) {
          super(fm);
          this.frag1 = frag1;
          this.frag2 = frag2;
          this.frag3 = frag3;
  
  
      }
  
      @Override
      public Fragment getItem(int index) {
          switch (index) {
              case 0:
                  //fragments should record no and reset to the same frag with new content back in position 1
  
                  return frag2;
              case 1:
                  //fragments for activity
                  return frag2;
              case 2:
                  //fragments should record yes and reset to the same frag with new content back in position 1
                  return frag2;
          }
  
          return null;
      }
  
  
      //return count for number of tabs/swipes
      @Override
      public int getCount() {
          return 3;
      }
  }
  </code></pre>
  
  <p>xml of activity:</p>
  
  <pre><code>     &lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="match_parent"&gt;
      &lt;android.support.v4.widget.DrawerLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/drawer_layout"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;!-- Framelayout to display Fragments --&gt;
          &lt;FrameLayout
              android:id="@+id/frame_container"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
  
          &lt;!-- Listview to display slider menu --&gt;
          &lt;ListView
              android:id="@+id/list_slidermenu"
              android:layout_width="240dp"
              android:layout_height="match_parent"
              android:layout_gravity="start"
              android:choiceMode="singleChoice"
              android:divider="@color/list_divider"
              android:dividerHeight="1dp"
              android:listSelector="@drawable/list_selector"
              android:background="@color/list_background"/&gt;
          &lt;!--View pager inside drawer so when opens it displays --&gt;
          &lt;LinearLayout
              android:orientation="vertical"
              android:layout_width="wrap_content"
              android:layout_height="300dp"
              android:id="@+id/viewPageLinear"&gt;
              &lt;android.support.v4.view.ViewPager
                  android:id="@+id/random_pager"
                  android:layout_width="wrap_content"
                  android:layout_height="300dp"&gt;
  
              &lt;/android.support.v4.view.ViewPager&gt;
              &lt;Button
                  android:layout_width="80dp"
                  android:layout_height="80dp"
                  android:gravity="center"
                  android:id="@+id/no"
                  android:layout_below="@+id/viewPageLinear"/&gt;
              &lt;Button
                  android:layout_width="80dp"
                  android:layout_height="80dp"
                  android:gravity="center"
                  android:layout_below="@+id/no"/&gt;
          &lt;/LinearLayout&gt;
  
      &lt;/android.support.v4.widget.DrawerLayout&gt;
  
  
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>xml of fragment loaded:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="match_parent"&gt;
  &lt;ImageView
      android:layout_width="200dp"
      android:layout_height="200dp"
      android:gravity="center"
      android:layout_alignParentTop="true"
      android:id="@+id/imagehere"/&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>