Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/222.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android在CursorAdapter getView()中处理耗时的查询_Android - Fatal编程技术网

Android在CursorAdapter getView()中处理耗时的查询

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

上面是我在getView中的代码块。db.isRegisteredcontactId_text方法是一个需要一些时间才能得到结果的查询,因此它滞后于我的listview滚动屏幕,有什么好的方法来处理这个问题?我尝试了AsyncTask,但当列表太长时,就会出现AsyncTask限制错误,忘记了异常名称。

确定解决了!我使用MatrixCursor形成自己的自定义游标,然后在listadapter上设置该游标

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);
        }
...
}