Her şeyden önce benim ana lang ve ben ingilizce sux biliyorum. 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.Listview yeni öğe ekledikten sonra ferahlatıcı değil
DÜZENLEME: Güncellenmiş kod ama hala şans MyAdapter:
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();
}
}
Ve My Sınıf:
@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);
}
}
}
çünkü yerine adapter.notifyDataSetChanged ait –
() adaptöre bu öğeleri gönderirken yapılamaz yeni öğeler alırken; adapter.notifyiteminserted'i denediniz (list.size()); –
Olası kopyası [Liste görünümünde öğeleri dinamik olarak ekle] (http://stackoverflow.com/questions/6938464/dynamically-add-items-in-list-view) –