Code example for GridView

Methods: setColumnWidthsetNumColumns

0
        numColumns = Math.min(numColumns, maxColumns);
        numColumns = Math.max(numColumns, minColumns);
        int remainingSpace = screenWidth - numColumns * minColumnWidth;
        int columnWidth = minColumnWidth + remainingSpace / numColumns;
 
        grid.setNumColumns(numColumns);
        grid.setColumnWidth(columnWidth);
 
        return columnWidth;
    } 
 
    @Override 
    protected void onStart() { 
        spiceManager.start(this);
 
        FlickrInterestingPhotosRequest request = new FlickrInterestingPhotosRequest(FLICKR_API_KEY);
        PhotoListRequestListener requestListener = new PhotoListRequestListener();
        spiceManager.execute(request, requestListener);
 
        spiceManager.addListenerIfPending(FlickrPhotoList.class, FLICKR_API_KEY, requestListener);
        spiceManager.getFromCache(FlickrPhotoList.class, FLICKR_API_KEY, DurationInMillis.ONE_MINUTE, requestListener);