Basbous
Basbous

Reputation: 3925

Android: Add cells to GridView dynamically?

I am want to add cells to GridView dynamically when the user reach the last row of cells its like the show more?

Upvotes: 2

Views: 1529

Answers (1)

Paul Burke
Paul Burke

Reputation: 25584

Check out CommonsWare EndlessAdapter. Very straight-forward Adapter implementation.

You could also manually use an OnScrollListener on the GridView. Use the onScrollStateChanged() callback to figure out when the grid is OnScrollListener.SCROLL_STATE_IDLE, then determine if the last grid item is visible. If so, get more items for your Adapter, and call notifyDataSetChanged().

Upvotes: 3

Related Questions