0
我想做一個列表視圖,當用戶滾動到列表視圖的底部其他項目的列表自動填充internet.I編寫代碼到該可擴展列表視圖的適配器(在getGroupView()方法)像這樣,如何更新用戶向下滾動的列表視圖?
public View getGroupView(final int arg0, final boolean arg1, View arg2, ViewGroup arg3) {
//if(arg2==null){
//arg2=act.getLayoutInflater().inflate(R.layout.layout_exlistview_group, null);
}
//((TextView)arg2.findViewById(R.id.nameText)).setText(item.getItemName());
if(arg0>=getGroupCount()-1){//chech is near for end
/*here i run a asynctask to download data and add items to SparseArray of this class.That sparsearray is the source to the adapter to view them in listview*/
}
//return arg2;
}
那麼這是正確的方式來做到這一點,或者有沒有什麼好辦法做到這一點?
這應該有助於http://benjii.me/2010/08/endless-scrolling-listview-in-android/ – Swayam