当前位置: 首页 > news >正文

nullnullDefining and Launching the Query 定义和启动查询

PS:今天上午,非常郁闷,有很多简单基础的问题搞得我有些迷茫,哎,代码几天不写就忘。目前又不当COO,还是得用心记代码哦!

    To perform a query, create the CursorLoader, set up its query, and pass it to the loader framework. From then on, the framework manages everything. It runs the query on a background thread, returns the results to the foreground, and watches for changes to the data associated with the query. http://blog.csdn.net/sergeycao

    Pass a CursorLoader to the loader framework in your implementation ofonCreateLoader(). The loader framework calls this method when youcreate a loader by calling initLoader(). You can create aCursorLoader anywhere, but the preferred way is to create it inonCreateLoader(), because this defers creation until the object is actually needed.

    Notice that initLoader() will only onCreateLoader() if theCursorLoader doesn't already exist; otherwise, it re-uses the existingCursorLoader. The loader framework tracks CursorLoader instance using theid value passed to initLoader().

    

Define and Launch the Query

    每日一道理
微笑,是春天里的一丝新绿,是秋日里的一缕阳光,是骄阳下的一片浓荫,是冬雪中的一株梅红……微笑着去面对吧,你会感到人生是那样的温馨与甜蜜!

    To create a CursorLoader and define its query at the same time, call the constructorCursorLoader(context, uri, projection, selection, selectionArgs, sortOrder). Thecontext and uri arguments are required, but the others are optional. To use the default value for an optional argument, pass innull. The CursorLoader runs the query against theContentProvider identified by uri, just as if you had calledContentResolver.query() with the same arguments.

    For example:

public Loader<Cursor> onCreateLoader(int loaderID, Bundle bundle)
{
    /*
     * Takes action based on the ID of the Loader that's being created
     */
    switch (loaderID) {
        case URL_LOADER:
            /*
             * Return a new CursorLoader
             */
            return new CursorLoader(
                this,                           // Context
                DataProviderContract.IMAGE_URI, // Provider's content URI
                PROJECTION,                     // Columns to return
                null,                           // Return all rows
                null,                           // No search arguments
                null);                          // Default search order
        default:
            // An invalid id was passed in
            return null;
    }
}

文章结束给大家分享下程序员的一些笑话语录: AdobeFlash拖垮Windows拖垮IE!又拖垮Linux拖垮Ubuntu拖垮FirxEox!还拖垮BSD拖垮MacOS拖垮Safri!简直无所不拖!AdobeFlash滚出网路世界!不要以为市占有率高就可以持续出烂货产品!以后替代品多得是!

转载于:https://www.cnblogs.com/jiangu66/archive/2013/05/09/3069881.html

相关文章:

  • IT知名公司工资一览
  • C++ const的用法
  • sourceforge开源项目
  • Winform 常用技巧
  • Keil 仿真之外设控制(System Viewer)
  • Qt 实现多文档
  • 局部特征(4)——SIFT和SURF的比较
  • 传感网和物联网的由来、进展与发展趋势
  • Linux多线程服务端编程:使用muduo C++网络库
  • 移动互联网终端策略研究
  • JavaScript中的shift()和pop()函数
  • 拿到第8期程序员杂志了,上面有我的Haskell文章
  • 博客开通第64天
  • 用正则截取字符串中的中文
  • Sql查询语句过滤重复的数据
  • 【前端学习】-粗谈选择器
  • 【知识碎片】第三方登录弹窗效果
  • CSS 专业技巧
  • Docker 1.12实践:Docker Service、Stack与分布式应用捆绑包
  • ES学习笔记(12)--Symbol
  • Java编程基础24——递归练习
  • Laravel 实践之路: 数据库迁移与数据填充
  • NLPIR语义挖掘平台推动行业大数据应用服务
  • nodejs实现webservice问题总结
  • PHP 小技巧
  • Python学习之路16-使用API
  • RxJS 实现摩斯密码(Morse) 【内附脑图】
  • webpack项目中使用grunt监听文件变动自动打包编译
  • 不发不行!Netty集成文字图片聊天室外加TCP/IP软硬件通信
  • 可能是历史上最全的CC0版权可以免费商用的图片网站
  • 如何在 Tornado 中实现 Middleware
  • 一个SAP顾问在美国的这些年
  • 用element的upload组件实现多图片上传和压缩
  • 走向全栈之MongoDB的使用
  • ​力扣解法汇总946-验证栈序列
  • ​如何在iOS手机上查看应用日志
  • #Lua:Lua调用C++生成的DLL库
  • #宝哥教你#查看jquery绑定的事件函数
  • (2.2w字)前端单元测试之Jest详解篇
  • (板子)A* astar算法,AcWing第k短路+八数码 带注释
  • (第二周)效能测试
  • (翻译)terry crowley: 写给程序员
  • (算法)前K大的和
  • (转)ORM
  • (转)Scala的“=”符号简介
  • (转)关于如何学好游戏3D引擎编程的一些经验
  • .Net - 类的介绍
  • .net 托管代码与非托管代码
  • .NetCore项目nginx发布
  • .so文件(linux系统)
  • @FeignClient 调用另一个服务的test环境,实际上却调用了另一个环境testone的接口,这其中牵扯到k8s容器外容器内的问题,注册到eureka上的是容器外的旧版本...
  • [23] 4K4D: Real-Time 4D View Synthesis at 4K Resolution
  • [AIGC] SQL中的数据添加和操作:数据类型介绍
  • [Android学习笔记]ScrollView的使用
  • [CentOs7]搭建ftp服务器(2)——添加用户