@ Override public Object instantiateItem ( ViewGroup parent , int position ) { T content = getItem ( position ) ; rendererBuilder . withContent ( content ) ; rendererBuilder . withParent ( parent ) ; rendererBuilder . withLayoutInflater ( LayoutInflater . from ( parent . getContext ( ) ) ) ; Renderer < T > renderer = rendererBuilder . build ( ) ; if ( renderer == null ) { throw new NullRendererBuiltException ( "RendererBuilder have to return a not null Renderer" ) ; } updateRendererExtraValues ( content , renderer , position ) ; renderer . render ( ) ; View view = renderer . getRootView ( ) ; parent . addView ( view ) ; return view ; }
Main method of VPRendererAdapter . This method has the responsibility of update the RendererBuilder values and create or recycle a new Renderer . Once the renderer has been obtained the RendereBuilder will call the render method in the renderer and will return the Renderer root view to the ViewPager .