GridView setAdapter - 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 setAdapter method.

This code example shows how to use the following methods:setVisibility, setAdapter
 
    @Override 
    public void onNewPhotos(List<FeedItem> photos) {
        mAdapter = new PhotosListAdapter(getSherlockActivity());
        mAdapter.fillWithItems(photos);
        mGridView.setAdapter(mAdapter);
        mAdapter.notifyDataSetChanged();
 
        mProgress.setVisibility(GONE);
        mGridView.setVisibility(VISIBLE);
    } 
 
    public GridView getGridView() {
        return mGridView;
    } 
 
    @Override 
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        getPhotoActivity().showDetailWithSelection(i);
    } 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOnScrollListener, setAdapter, setOnItemClickListener
				View shelf = mDisplayView.findViewWithTag(TAG_SHELF);
				if (shelf != null && shelf instanceof GridView && mItemLayoutResId != 0) {
					mShelfView = (GridView) shelf;
					mShelfAdapter = new ShelfAdapter(mContext, mItemLayoutResId, mImageLoader, (ITableDatabaseController) mDataSet
							.getDatabaseController(mItemTable));
					mShelfView.setAdapter(mShelfAdapter);
					mShelfView.setOnScrollListener(mShelfAdapter);
 
					if (mOnShelfItemClickListener != null) {
						mShelfView.setOnItemClickListener(mOnShelfItemClickListener);
					} 
 
					if (mDefaultBackgroundResId != INVALID_RESOURCE_ID && mSelectedBackgroundResId != INVALID_RESOURCE_ID) {
						mShelfAdapter.setBackgroundDrawable(mDefaultBackgroundResId, mSelectedBackgroundResId);
					} 
				} else { 
					mShelfView = null;
				} 
 
				// create detail area. 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setVisibility, setAdapter
    @Override 
    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
        if (loader.getId() == LOADER_SNAPSHOTS) {
            if (mAdapter == null) {
                mAdapter = new SnapshotAdapter(getActivity(), data);
                mGrid.setAdapter(mAdapter);
            } else { 
                mAdapter.changeCursor(data);
            } 
            if (mAnimateId > 0) {
                mAdapter.animateIn(mAnimateId);
                mAnimateId = 0;
                getArguments().remove(EXTRA_ANIMATE_ID);
            } 
            boolean empty = mAdapter.isEmpty();
            mGrid.setVisibility(empty ? View.GONE : View.VISIBLE);
            mEmpty.setVisibility(empty ? View.VISIBLE : View.GONE);
        } 
    } 
 
    @Override 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setAdapter
	 
	public void setEmotionGridViewAdapter(EmotionsGridAdapter adapter) {
		if (emotionGrid == null) {
			setEmotionGridView(); 
		} 
		emotionGrid.setAdapter(adapter);
	} 
	 
	public void setEmotionGridViewOnItemClickListener(EditMicroBlogEmotionItemClickListener listener) {
		if (emotionGrid == null) {
			setEmotionGridView(); 
		} 
		emotionGrid.setOnItemClickListener(listener);
	} 
	 
	public int getEmotionViewVisibility() { 
		if (llEmotion == null) {
			setLlEmotion(); 
		} 
		return llEmotion.getVisibility();
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setAdapter, setNumColumns
	public void create() 
	{ 
		setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		setGravity(Gravity.CENTER);
		 
		grid = new GridView(context);
		adapter = new DesktopSwitcherAdapter(context);
		 
		workspace = myHome.getInstance().getWorkspace();
		desktopCount = workspace.getDesktopCount();
		 
		columnCount = desktopCount;
		if(columnCount > 4)
			columnCount = 4;
		 
		grid.setNumColumns(columnCount);
		grid.setAdapter(adapter);
		 
		addView(grid);
	} 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getLayoutParams, setLayoutParams, setAdapter, setColumnWidth, setHorizontalSpacing
	    	m_oTitle2Text.setText("����������20��");
	    } 
	     
	    if( m_oInfoGrid != null )
	    { 
	    	LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)m_oInfoGrid.getLayoutParams();
    		lp.height = dm.heightPixels - 45 - 200;
    		m_oInfoGrid.setLayoutParams(lp);
    		 
	    	m_oInfoGrid.setNumColumns(4);
	    	m_oInfoGrid.setColumnWidth(dm.widthPixels/4);
	    	m_oInfoGrid.setHorizontalSpacing(10);
	    	 
	    	String[] str = {"����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123",
	    			"����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", 
	    			"����\n123", "����\n123", "����\n123"}; 
	    	 
	    	mySpinnerAdapter sa = new mySpinnerAdapter( this, str );
	    	m_oInfoGrid.setAdapter(sa);
	    } 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setAdapter, getSelectedItemId, setEmptyView, setOnItemClickListener
    /** 
     * Get the cursor row ID of the currently selected grid item. 
     */ 
    public long getSelectedItemId() { 
        ensureGrid(); 
        return mGrid.getSelectedItemId();
    } 
 
    /** 
     * Get the activity's {@link GridView} widget. 
     */ 
    public GridView getGridView() {
        ensureGrid(); 
        return mGrid;
    } 
 
    /** 
     * The default content for a ListFragment has a TextView that can 
     * be shown when the grid is empty.  If you would like to have it 
     * shown, call this method to supply the text it should use. 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setRecyclerListener, setAdapter, setColumnWidth, setHorizontalSpacing, setStretchMode
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(this.getResources().getIdentifier("test_activity_grid", "layout", "pl.polidea.androidflip3d"));
        final GridView gridView = (GridView) findViewById(this.getResources().getIdentifier("GridView", "id",
                "pl.polidea.androidflip3d")); 
        gridView.setHorizontalSpacing(0);
        final int screenWidth = this.getWindow().getWindowManager().getDefaultDisplay().getWidth();
        final int margin = 10;
        Log.v(TAG, "Screen width = " + screenWidth);
        gridView.setColumnWidth(screenWidth / 3 - margin * 2 / 3);
        gridView.setStretchMode(GridView.NO_STRETCH);
        gridView.setHorizontalSpacing(margin / 2);
        gridView.setVerticalSpacing(margin / 2);
        final TestGridAdapter adapter = new TestGridAdapter(this, screenWidth / 3 - margin);
        gridView.setAdapter(adapter);
        gridView.setRecyclerListener(adapter);
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  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);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setPadding, setVerticalScrollBarEnabled, setAdapter, setGravity, setNumColumns
		 
		Vector <DataIndicator> currentRow = rows.get(position);
		 
		GridView gridView;
        if (convertView == null) {
        	gridView = new GridView(mContext);
             
            gridView.setVerticalScrollBarEnabled(false);          
 
            gridView.setNumColumns(currentRow.size());
            gridView.setPadding(1,1,1,1);
            //gridView.setLayoutParams(new LayoutParams (LayoutParams.FILL_PARENT, 40)); 
            gridView.setGravity(Gravity.CENTER);
            gridView.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
 
        } else { 
        	gridView = (GridView) convertView;
        } 
 
        DataListItemAdapter itemAdapter = new DataListItemAdapter(mContext, currentRow, false);

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related GridView setAdapter Questions & Answers:

Other GridView setAdapter Examples

40:	
41:			// setting grid view adapter
42:			gridView.setAdapter(adapter);
43:		}
44:

Read More

18:			// Instance of ImageAdapter Class
19:			gridView.setAdapter(new ImageAdapter(this));
20:	
21:			/**
22:			 * On Click event for Single Gridview Item

Read More

18:			// Instance of ImageAdapter Class
19:			gridView.setAdapter(new ImageAdapter(this));
20:		}
21:	}
22:

Read More

4:	
5:	    GridView gridview = (GridView) findViewById(R.id.gridview);
6:	    gridview.setAdapter(new ImageAdapter(this));
7:	
8:	    gridview.setOnItemClickListener(new OnItemClickListener() {

Read More

setAdapter Method Overview
Sets the data behind this GridView.
See Code Examples for other Android GridView Methods: