Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CursorLoader with rawQuery

Tags:

android

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.

like image 944
Emil Davtyan Avatar asked Sep 29 '11 15:09

Emil Davtyan


1 Answers

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.

like image 112
CommonsWare Avatar answered Sep 19 '22 23:09

CommonsWare