简体   繁体   English

在Android中运行Cursor的最有效方法是什么?

[英]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.

相关问题 Android最有效的保存和加载图像的方法是什么? - Android what's the most efficient way to save and load images? 在Android中显示表格的最有效方法是什么 - What is the most efficient way to display a table in Android 使用Android相机的最有效方法是什么? - What is the most efficient way to work with the Android camera? 在Android的“ ActionBar”中控制“ MenuItem”的最佳方式(最有效或最常规)是什么? - What is the best (most efficient or conventional) way to control “MenuItem”s in Android's “ActionBar”? 在Android中的本机代码和Java代码之间传输数据/数据包的最有效方法是什么 - What's the most efficient way to transfer data/packets between native code and Java code in Android 更改应用程序整体主题的最有效方法是什么? - What's the most efficient way to change the overall theme of the app? 在XML中关联不同数据的最简单,最有效的方法是什么? - What's the simplest and most efficient way to associate different data in XML? 在Android用户界面中旋转和显示图像的最有效方法是什么? - What is the most efficient way to rotate and display an image in an Android UI? 在android中,比较两个文件以确定它们是否相同的最有效方法是什么? - In android, what is the most efficient way to compare two files to determine if they are identical? 什么是最有效的(电池)重复动作在android中的方法? - what is the most efficient(battery) way to repeat an action in android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM