android – 在contentProvider中选择前n行

我选择这个:
final Cursor cursorConversations = getContentResolver().query(
        Uri.parse("content://gmail-ls/conversations/" + Uri.encode(mailAddress)),null,BaseColumns._ID + " DESC");

 ContentQueryMap mQueryMap 
        = new ContentQueryMap(cursorConversations,BaseColumns._ID,true,null);

使用ContentQueyMap,我可以缓存Cursor数据并在Cursor关闭的情况下迭代它(我需要它来提升性能).

现在,我想要选择Corsor只检索前五十行.在mQueryMap.getRows().entrySet()中循环50次的解决方案是不正确的:我不希望mQueryMap获取Cursor的所有行,但只有前五十行.

任何的想法?是否存在where子句只能获得前n行?

解决方法

你可以做到
final Cursor cursorConversations = getContentResolver().query(
    Uri.parse("content://gmail-ls/conversations/" + Uri.encode(mailAddress)),BaseColumns._ID + " DESC " + " LIMIT 5");

排序后“LIMIT x”.

干杯

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...