GridView getAdapter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for GridView getAdapter method.

This code example shows how to use the following methods: getLayoutParams, setLayoutParams, getAdapter, getNumColumns
		lp.height = height;
		lv.setLayoutParams(lp);
	} 
 
	public static void makeGridViewFullSize(GridView gv, int itemHeight) {
		int itemCount = gv.getAdapter().getCount();
		int columns = gv.getNumColumns();
		int lines = (int) (itemCount / columns);
		if (itemCount % columns != 0) {
			lines++;
		} 
		ViewGroup.LayoutParams lp = gv.getLayoutParams();
		lp.height = lines * itemHeight;
		gv.setLayoutParams(lp);
 
	} 
} 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getLayoutParams, setLayoutParams, getAdapter, getNumColumns
		lp.height = height;
		lv.setLayoutParams(lp);
	} 
 
	public static void makeGridViewFullSize(GridView gv, int itemHeight) {
		int itemCount = gv.getAdapter().getCount();
		int columns = gv.getNumColumns();
		int lines = (int) (itemCount / columns);
		if (itemCount % columns != 0) {
			lines++;
		} 
		ViewGroup.LayoutParams lp = gv.getLayoutParams();
		lp.height = lines * itemHeight;
		gv.setLayoutParams(lp);
 
	} 
} 
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getChildAt, getChildCount, getListPaddingTop, getAdapter
                newLastChild.getId());
    } 
     
    @LargeTest 
    public void testShortScroll() { 
        View firstChild = mGridView.getChildAt(0);
        if (firstChild.getTop() < this.mGridView.getListPaddingTop()) {
            firstChild = mGridView.getChildAt(1);
        } 
             
        View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
         
        int lastTop = lastChild.getTop();
         
        TouchUtils.dragViewBy(this, firstChild, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0,
                ViewConfiguration.getTouchSlop() + 1 + 10);
         
        View newLastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
         
        assertEquals("View scrolled to wrong position", lastTop, newLastChild.getTop() - 10);

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getLayoutParams, setLayoutParams, getAdapter
        lp.height = height;
        lv.setLayoutParams(lp);
    } 
 
    public static void makeGridViewFullSize(GridView gv, int itemHeight, int rowNum) {
        int itemCount = gv.getAdapter().getCount();
        int lines = (int) (itemCount / rowNum);
        if (itemCount % rowNum != 0) {
            lines++;
        } 
        ViewGroup.LayoutParams lp = gv.getLayoutParams();
        lp.height = lines * itemHeight;
        gv.setLayoutParams(lp);
 
    } 
 
    public static int getActionBarHeight() { 
        TypedArray a = context.obtainStyledAttributes(new int[]{ACTIONBAR_HEIGHT});
        int ret = a.getDimensionPixelSize(0, -1);
        a.recycle();
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getHeight, getChildAt, getChildCount, getListPaddingBottom, getAdapter
                mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
    } 
     
    @MediumTest 
    public void testPushUpFast() { 
        TouchUtils.dragViewToTop(this, mGridView.getChildAt(mGridView.getChildCount() - 1), 2);
 
        // Nothing should be selected 
        assertEquals("Selection still available after touch", -1,
                mGridView.getSelectedItemPosition());
 
        View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
 
        assertEquals("Last item not the last child in the grid",
                mGridView.getAdapter().getCount() - 1, lastChild.getId());
 
        assertEquals("Last item not at the bottom of the grid",
                mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
    } 
 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: scrollToBottom, getHeight, getChildAt, getChildCount, getListPaddingBottom
                mGridView.getListPaddingTop(), firstChild.getTop());
    } 
 
    @MediumTest 
    public void testScrollToBottom() { 
        TouchUtils.scrollToBottom(this, mGridView);
 
        // Nothing should be selected 
        assertEquals("Selection still available after touch", -1,
                mGridView.getSelectedItemPosition());
 
        View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
 
        assertEquals("Grid is not scrolled to the bottom", mGridView.getAdapter().getCount() - 1,
                lastChild.getId());
 
        assertEquals("Last item is not touching the bottom edge",
                mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
    } 
} 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getLayoutParams, setLayoutParams, getAdapter, getNumColumns
		lp.height = height;
		lv.setLayoutParams(lp);
	} 
 
	public static void makeGridViewFullSize(GridView gv, int itemHeight) {
		int itemCount = gv.getAdapter().getCount();
		int columns = gv.getNumColumns();
		int lines = (int) (itemCount / columns);
		if (itemCount % columns != 0) {
			lines++;
		} 
		ViewGroup.LayoutParams lp = gv.getLayoutParams();
		lp.height = lines * itemHeight;
		gv.setLayoutParams(lp);
 
	} 
} 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setOnScrollListener, getAdapter, setAdapter, setOnItemClickListener
            ima.setCatalog(icatalog);
            // notify adapter to change content 
            ima.not();
        } 
        if (null != gridView) {
            if (null == gridView.getAdapter()) {
                gridView.setAdapter(ima);
            } 
            gridView.setOnScrollListener(new GridScrollListener(ima, icatalog));
            gridView.setOnItemClickListener(new OnGalleryItemClick(icatalog));
        } 
        return this;
    } 
 
    public void setFilterSearch(final String filter) {
        if ((filter == null) || "".equals(filter)) {
            return; 
        } 
        if (!filter.equals(LinksHolder.getInstance().getFilter())) {
            LinksHolder.getInstance().setFilter(filter);
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getAdapter, setAdapter, setNumColumns
	    Log.d(getClass().getSimpleName(), "multimedia url = " + multimedia);
	    image.setImageURI(Uri.parse(activeSurvey.getPath() + "/img/"
		    + multimedia));
	} 
 
	grid.setNumColumns(activeQuestion.getColumns());
	grid.setAdapter(new AnswersAdapter(activeQuestion, this));
 
	SQLiteDatabase db = mDbHelper.getReadableDatabase();
	Cursor cursor = db.rawQuery(
		"select answer_value from survey_answers where survey_id = " 
			+ activeSurvey.surveyID + " and question_id = ?", null);
	if (cursor.getCount() > 0) {
	    db.close();
	    String result = cursor.getString(0);
	    ((AnswersAdapter) grid.getAdapter()).setResult(result);
	} else { 
	    db.close();
	    db = mDbHelper.getWritableDatabase();
	    db.execSQL("insert into survey_answers (survey_id, question_id, answer_value) values ("
		    + activeSurvey.surveyID
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getAdapter, getSelectedItemPosition
     
    @Override 
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_DEL) {
            GridView g = getGridView();
            ((DeleteAdapter)g.getAdapter()).deletePosition(g.getSelectedItemPosition());
            return true; 
        } else { 
            return super.onKeyDown(keyCode, event);
        } 
    } 
 
 
 
 
    private class DeleteAdapter extends BaseAdapter {
         
        private ArrayList<Integer> mData;
         
        public DeleteAdapter(int initialNumItems) {
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related GridView getAdapter Questions & Answers:

getAdapter Method Overview
Returns the adapter currently associated with this widget.
See Code Examples for other Android GridView Methods: