博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Defining and Launching the Query 定义和启动查询
阅读量:4045 次
发布时间:2019-05-24

本文共 1881 字,大约阅读时间需要 6 分钟。

To perform a query, create the , 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 to the loader framework in your implementation of. The loader framework calls this method when youcreate a loader by calling . You can create a anywhere, but the preferred way is to create it in, because this defers creation until the object is actually needed.

Notice that will only if the doesn't already exist; otherwise, it re-uses the existing. The loader framework tracks instance using theid value passed to .

Define and Launch the Query

To create a and define its query at the same time, call the constructor. Thecontext and uri arguments are required, but the others are optional. To use the default value for an optional argument, pass innull. The runs the query against the identified by uri, just as if you had called with the same arguments.

For example:

public Loader
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; }}
你可能感兴趣的文章
VS 2005 CRT函数的安全性增强版本
查看>>
SQL 多表联合查询
查看>>
Visual Studio 2010:C++0x新特性
查看>>
drwtsn32.exe和adplus.vbs进行dump文件抓取
查看>>
cppcheck c++静态代码检查
查看>>
在C++中使用Lua
查看>>
一些socket的编程经验
查看>>
socket编程中select的使用
查看>>
GitHub 万星推荐:黑客成长技术清单
查看>>
可以在线C++编译的工具站点
查看>>
关于无人驾驶的过去、现在以及未来,看这篇文章就够了!
查看>>
所谓的进步和提升,就是完成认知升级
查看>>
为什么读了很多书,却学不到什么东西?
查看>>
长文干货:如何轻松应对工作中最棘手的13种场景?
查看>>
如何用好碎片化时间,让思维更有效率?
查看>>
No.147 - LeetCode1108
查看>>
No.174 - LeetCode1305 - 合并两个搜索树
查看>>
No.175 - LeetCode1306
查看>>
No.176 - LeetCode1309
查看>>
No.182 - LeetCode1325 - C指针的魅力
查看>>