CursorLoader与rawQuery [英] CursorLoader with rawQuery

查看:195
本文介绍了CursorLoader与rawQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我寻找到我的应用程序执行CursorLoader但我有一个小问题,它似乎没有办法仅仅通过一个原始查询到CursorLoader构造。

我可能失去了一些东西的文档(和谷歌),因此,如果任何人都可以点我一个简单的方法来与CursorLoader类我会AP preciate它运行原始查询。否则,我将有可能与必要的功能,而我试图避免创建自己的CursorLoader类。

解决方案
  

似乎没有办法仅仅通过一个原始查询到CursorLoader构造。

这是因为 CursorLoader 作品与内容提供商和内容提供商不支持 rawQuery()

  

因此​​,如果任何人都可以点我一个简单的方法来与CursorLoader类运行原始查询我会AP preciate吧。

这是不可能的,对不起。欢迎您来创建自己的 AsyncTaskLoader 击中SQLite数据库,并支持 rawQuery()。事实上,我可能会在今年晚些时候写这些中的一个,如果我没有看到任何人击败了我吧。

I'm looking into implementing CursorLoader in my app but I'm having a small issue that it seems that there isn't a way to just a pass a raw query to the CursorLoader constructor.

I maybe missing something in the documentation (and google), so if anybody can point me to a simple way to run a raw query with a CursorLoader class I would appreciate it. Otherwise I will have to probably create my own CursorLoader class with the necessary functionality, which I'm trying to avoid.

解决方案

it seems that there isn't a way to just a pass a raw query to the CursorLoader constructor.

That is because CursorLoader works with content providers, and content providers do not support rawQuery().

so if anybody can point me to a simple way to run a raw query with a CursorLoader class I would appreciate it.

That is impossible, sorry. You are welcome to create your own AsyncTaskLoader that hits a SQLite database and supports rawQuery(). In fact, I will probably write one of these later this year, if I don't see where anyone has beaten me to it.

这篇关于CursorLoader与rawQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆