Android在CursorAdapter getView()中处理耗时的查询
上面是我在getView中的代码块。db.isRegisteredcontactId_text方法是一个需要一些时间才能得到结果的查询,因此它滞后于我的listview滚动屏幕,有什么好的方法来处理这个问题?我尝试了AsyncTask,但当列表太长时,就会出现AsyncTask限制错误,忘记了异常名称。确定解决了!我使用MatrixCursor形成自己的自定义游标,然后在listadapter上设置该游标Android在CursorAdapter getView()中处理耗时的查询,android,Android,上面是我在getView中的代码块。db.isRegisteredcontactId_text方法是一个需要一些时间才能得到结果的查询,因此它滞后于我的listview滚动屏幕,有什么好的方法来处理这个问题?我尝试了AsyncTask,但当列表太长时,就会出现AsyncTask限制错误,忘记了异常名称。确定解决了!我使用MatrixCursor形成自己的自定义游标,然后在listadapter上设置该游标 public View getView(int position, View conver
public View getView(int position, View convertView, ViewGroup parent) {
...
boolean flag = db.isRegistered(contactId_text);
ImageView iv = (ImageView) vi.findViewById(R.id.typeImage);
if (flag) {
holder.image1.setImageResource(R.drawable.registered);
}
...
}