[英]What's the most efficient way to run over a Cursor in Android?
有没有比在循环中调用moveToNext更快的方法?
As seen in the Cursor documentation there are only limited methods available to run through a cursor. 如Cursor 文档中所示,只有有限的方法可用于运行游标。
The only thing that could save some iterations of your loop is the moveToPosition method. 唯一可以保存循环迭代的是moveToPosition方法。
If you know that say the next 30 entries are not of interest you could jump ahead a bunch of positions. 如果你知道说接下来30个条目不感兴趣你可以跳过一堆位置。 The real question is why are you running through the pointer?
真正的问题是你为什么要通过指针?
If you query a Database and want to find a specific entry in the resulting cursors maybe you can narrow down the number of results with a more specific query. 如果您查询数据库并希望在生成的游标中找到特定条目,则可以使用更具体的查询缩小结果数量。
Thats the only method Cursor has got... it also has other similar methods but they too will do the same.. you cannot give your own way to traverse through it.. its APK level. 这是Cursor得到的唯一方法......它也有其他类似的方法,但它们也会做同样的事情......你不能用自己的方式遍历它......它的APK等级。 need to follow it..
需要遵循它..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.