Code example for ViewPager

Methods: setAdapter

    public PagedGrid(Context context, AttributeSet attrs) {
        super(context, attrs);
    public void setAdapter(BaseAdapter adapter,int columns, int rows){
        super.setAdapter(new GridPagerAdapter(adapter,columns,rows));
     * As we wrap an standard Adapter within our custom PagerAdapter, we do not want this class to be used otherwise 
     * @param adapter 
    public void setAdapter(PagerAdapter adapter) {
        throw new IllegalStateException("This class cares itself about the PagerAdapter. Call setAdapter(BaseAdapter,columns,rows) instead");
    private static class GridPagerAdapter extends PagerAdapter{ 
        private int PAGE_ROWS=4;
        private int PAGE_COLUMNS=4;