Search code examples
androidandroid-contentproviderandroid-2.2-froyo

Making complex queries through SQLiteDatabase


I'm using the Android MediaProvider application to get information regarding the resources registered in the media library. The only way I found to do this is to use the ContentProvider class provided by the MediaProvider application. Unfortunately, it seems to me this is quite a limitation, isn't it? Is it possible this way to create complex queries with subqueries and using other functions of SQLite? I thought that it may be possible using the SQLiteDatabase class, but it seems it is not possible to open the database directly with its path, and anyway, the query method seems not to allow subqueries. Any solution to this? Thanks!


Solution

  • The answers I found until now are that it is impossible (with a reasonable effort) to access another application's data (included databases) without using the ContentProvider and that a complex query may be executed with the rawQuery method of the class SQLiteDatabase. This means anyway that it must be executed in the ContentProvider itself.