title: ViewPager for custom View with canvas objects
body: <p>I'm searching for a solution to implement the ViewPager for a custom View. There are a lot of tutorials for ViewPager which inflates xml layouts, but I couldn't find an example with custom views. 
  My custom View class draws multiple objects (circles with text around it) on a canvas.
  <img src="https://i.stack.imgur.com/6ATTv.png" alt="enter image description here"> The objects can be moved and scaled by implementing the OnTouchListener. 
  The objects are generated dynamically ( the text comes from an ArrayList)</p>
  
  <p>In the Activity I instantiate a new View with different parameters: </p>
  
  <pre><code>this.mRenderCircleView = new RenderCircleView(this, resultList, showDemo);
  </code></pre>
  
  <p>The resultList holds an <code>ArrayList&lt;ArrayList&lt;String&gt;&gt;</code> with the circles to draw in the RenderCircleView. 
  I want to implement the ViewPager in the case, if there are a lot of circle items in the ArrayList ( > 5 ) and due to performance issues it would be bad to create and load all views previously. So I thing the best choice is the FragmentStatePagerAdapter. This should be the better solution for interactive content.</p>
  
  <p>But I couldn't figure out how it works. The count of Fragments would depend on the size of the given ArrayList divided by the count of elements which should be drawn in the RenderCircleView. For example the ArrayList size is 20 and 5 circleObjects should be drawn on each page, then I need 4 pages (fragments). </p>
  
  <p>What is the easiest way to use the ViewPager in this case?</p>