Android Question ContentResolver Query query (pardon my little pun)

JackKirk

Well-Known Member
Licensed User
Longtime User
I am using ContentResolver to query for images in the gallery, this being the documented Query call:

Query (Uri As Uri, Projection() As String, C, SelectionArgs() As String, SortOrder As String) As CursorWrapper

It seems that the selection clause (Selection As String) can only be a simple clause like:

"relative_path = ? AND mime_type = ?"

Which I have working, but I'd like to be able to do something like:

"relative_path CONTAINS ? AND mime_type = ?"

I have tried every permutation I can think of and googled myself silly without any luck.

Is this possible? If so can anyone give me some guidance as to the exact verbage.
 

JackKirk

Well-Known Member
Licensed User
Longtime User
agraham thanks for your interest.

You set me googling on SQL Where clause, this seemed simplest and most informative:

https://www.w3schools.com/sql/sql_where.asp

this implies I should be able to query on

"relative_path LIKE ? AND mime_type = ?"

but I couldn't get this to work either šŸ˜”šŸ˜”šŸ˜”
 
Upvote 0
Top