While i am working on gridview i faced following problems, any help will be appreciated,
When I load data to my gridview it loads only first 3 items of the arr
First, change your adapter to expends the
extends ArrayAdapter
Change the constructor:
public CustomGrid(Context c) {
super(c, R.layout.fragment_pizza);
}
Now Change getView()
method:
// Get the item
String item = getItem(position);
Set this item text to your view and if you require more data sets, create the model class and change
extends ArrayAdapter
with extends ArrayAdapter
and
// Get the item
ModelClass item = getItem(position);
Now in your Activity class, initilize the ModelClass, set it's variables and add to the adapter using add or addAll methods.