我用了下面的demohttp://blog.csdn.net/cjjky/article/details/6898871目前已实现了demo中的代码
可我换成 把写死的变成动态得到数据,就报错,报错有
1 The content of the adapter has changed but ListView did not receive a notifi
2 java.util.ArrayList.throwIndexOutOfBoundsException现问:1 哪位还有listview分页加载数据的demo吗
2 上面
可我换成 把写死的变成动态得到数据,就报错,报错有
1 The content of the adapter has changed but ListView did not receive a notifi
2 java.util.ArrayList.throwIndexOutOfBoundsException现问:1 哪位还有listview分页加载数据的demo吗
2 上面
为listview定义自己的适配类,getcount()返回值为要显示条数,此处你注意下;要实现分页,就当你的与适配器搭配的数据集合改变时,适配器对象调用一下notifidatachanged()方法就OK啦。
1 数组越界怎么处理呢
2 你说的那个方法 我已调用了 (在点击查看更多时调用的)
如下
public void onClick(View v) {
loadMoreButton.setText("正在加载中..."); //设置按钮文字
handlerl.postDelayed(new Runnable() {
@Override
public void run() {
loadMoreData();
adapterl.notifyDataSetChanged();
loadMoreButton.setText("查看更多..."); //恢复按钮文字
}
},4000);
}你再帮我看下怎么解决,thanks
loadMoreData()方法,我想你是往数据集合里加入了部分数据。应该这样就没什么问题了。
还有,你这样使用handler,如果加入数据耗时很长的话,UI就会被卡死了。。建议启动线程,在通过message来更改ui。