這是我的代碼列表視圖不notifydatasetchanged()調用
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);
上面的代碼工作fine.But當我我的代碼更改爲這個
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();
列表視圖不顯示anything.what更新問題是什麼?
如果你提供的源CustomAdap和週一,以及其中週一宣佈這將是更清晰。 – louielouie 2012-03-17 05:51:13
我已經添加了customadap的代碼,monday是SClass的Arraylist – 2012-03-17 05:58:54
@TariqIbrahim你可以看到http://stackoverflow.com/questions/28148618/listview-not-refreshing-after-click-on-button – 2015-01-27 13:01:53