public class grid_adapter extends BaseAdapter {
Context context;
ArrayList<String> Siparisler;
public grid_adapter (Context context, ArrayList<String> gelenSiparisler){
this.context=context;
this.Siparisler=gelenSiparisler;
}
public int getCount() {
// TODO Auto-generated method stub
return Siparisler.size();
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
@SuppressLint("InflateParams") public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View gridView;
if(convertView==null)
{
gridView =new View(context);
gridView = inflater.inflate(R.layout.grid_layout, null);
Button txtbtn = (Button) gridView.findViewById(R.id.gridbutton);
txtbtn.setText(Siparisler.get(position));
}
else
gridView = (View) convertView;
return gridView;
}
}
Yukarıda yazdığım gibi grid_adapter isimli sınıfı kullanıyorum. bilgiler ismindeki arraylist 'i gride aktarıyorum. herşey çalışıyor ama gridi aşağı kaydırınca doğru veri yukarı gelmiyor.