Code example for GridView

Methods: getAdaptergetNumColumns

0
            this.move(position);
        } 
 
        @Override 
        public void onBottomToTop() { 
            int nbCols = gridView.getNumColumns();
            position += nbCols;
 
            this.move(position);
 
        } 
 
        @Override 
        public void onTopToBottom() { 
            int nbCols = gridView.getNumColumns();
            position -= nbCols;
 
            this.move(position);
        } 
 
        /** 
         * Display the picture found at the given position 
         * @param position 
         *            the position of the picture to display 
         */ 
        private void move(int position) {
            if (position >= 0 && position < gridView.getAdapter().getCount()) {
                BitmapWorkerTask task = new BitmapWorkerTask(position);
                task.execute(0);
            } else { 
                Toast.makeText(getApplicationContext(), "On est déjà au bord l'ami !", Toast.LENGTH_SHORT).show();
            }