据我所知,Android listview 显示虚拟化的数据(意味着它只加载可见的数据),所以它的速度尽可能快。
我有很多数据要从数据库中获取(大约 2000 年,但字段中有很多数据),我在 AsyncTask 中使用 ActiveAndroid 来获取它们。
不幸的是,带有 AA 的 AsyncTask 需要大约 10-15 秒才能获取数据,所以我在那段时间看到了一个进度条。
我通过这段代码得到他的:
LocalDateTime start=new LocalDateTime();
LogCat("Start: "+start);
elements = new Select().from(Data.class)
.where("Data_Id=?", DataId).orderBy("Name ASC").execute();
LogCat("Elements: "+elements .size());
LocalDateTime end=new LocalDateTime();
LogCat("End: "+end);
LogCat("Time: "+(new Period(start,end).getSeconds()+" s"));
通过以某种方式虚拟化数据检索来加速加载会很好。
我还在列表视图中使用搜索,它搜索整个列表。所以考虑到也会很好。
你有什么建议?我应该如何进行?