Iknow cevapladı birçok kez ama bir şekilde benim için çalışmaz.Her tek "ListView değil ferahlatıcı" iplik çalıştı ama yine de hayır şans. Liste listemi yenileyemiyorum.Ne yanlış yapıyorum? Kodda hata ayıkladığımda yeni öğeleri görebiliyorum ama liste görünümü görünmüyor.Android Liste Yenileme değil
public class BuzagiListAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private List<BuzagiKayitDBean> mBuzagiList;
Context context;
public BuzagiListAdapter(List<BuzagiKayitDBean> sorgu, Activity activity) {
mInflater = (LayoutInflater) activity.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
mBuzagiList = sorgu;
}
public void add(List<BuzagiKayitDBean> buz) {
for(BuzagiKayitDBean item :buz)
{
mBuzagiList.add(item);
}
notifyDataSetChanged();
}
@Override
public int getCount() {
return mBuzagiList.size();
}
@Override
public BuzagiKayitDBean getItem(int position) {
return mBuzagiList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View satirView;
satirView = mInflater.inflate(R.layout.buzagilist_row, null);
TextView textView =
(TextView) satirView.findViewById(R.id.txtblDogumSonucuandKupeNo);
TextView textView2 =
(TextView) satirView.findViewById(R.id.txtblCinsiyetandPadok);
BuzagiKayitDBean buz = mBuzagiList.get(position);
textView.setText(buz.getDogumSonuc() + "-" + buz.getKupeNo());
textView2.setText(buz.getCinsiyet() + " -" + buz.getGidecegiPadok());
return satirView;
}
public void updateNewList(ArrayList<BuzagiKayitDBean> array){
mBuzagiList = array;
notifyDataSetChanged();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 2) {
String kpn = data.getStringExtra("kupeno");
txtddtyKupeNo.setText(kpn);
}
if (resultCode == 3) {
ArrayList<BuzagiKayitDBean> arraylist = data.getParcelableArrayListExtra("mylist");
BuzagiKayitDBean buzd = new BuzagiKayitDBean();
adapter = new BuzagiListAdapter(dty, BuzagiKayitActivity.this);
for (BuzagiKayitDBean item : arraylist) {
buzd.setGidecegiPadok(item.getGidecegiPadok());
buzd.setKupeNo(item.getKupeNo());
buzd.setCinsiyet(item.getCinsiyet());
buzd.setDogumSonuc(item.getDogumSonuc());
}
dty.add(buzd);
if(adapter == null){
adapter = new BuzagiListAdapter(dty, BuzagiKayitActivity.this);
buzlist.setAdapter(adapter);
}else{
adapter.updateNewList((ArrayList<BuzagiKayitDBean>)dty);
}
}
}``
dty.add (buzd) içerisinde DTY hattı ne –
ArrayList dty = new ArrayList (); –
İçinde birçok kez vızıltı ayarlıyorsunuz (arraylist). ve yalnızca bir buzluğu dty'ye ekledikten ve bağdaştırıcıyı güncelleştirdikten sonra. –