Questo è il mio codiceListView non aggiornare con notifydatasetchanged() chiamata
listview =(ListView) findViewById(R.id.lv1);
ArrayList<SClass> Monday = new ArrayList<SClass>();
SClass s1=new SClass();
s1.sName="samp";
s1.salary=1000;
Monday.add(s1);
temp=Monday;
adapter = new CustomAdap(this, temp);
listview.setAdapter(adapter);
Il codice precedente funziona fine.But quando cambio il mio codice a questo
listview =(ListView) findViewById(R.id.lv1);
adapter = new CustomAdap(this, temp);
SClass s1=new SClass();
s1.sName="samp";
s1.salary=1000;
Monday.add(s1);
temp=Monday;
listview.setAdapter(adapter);
adapter.notifyDataSetChanged();
ListView non mostrare anything.what è il problema?
Questo sarebbe più chiaro se hai fornito la fonte per CustomAdap e Lunedi, così come dove è dichiarato Lunedi. – louielouie
ho aggiunto il codice per customadap e lunedì è un Arraylist di SClass –
@TariqIbrahim puoi vedere http://stackoverflow.com/questions/28148618/listview-not-refreshing-after-click-on-button –