I have a data table that has one column called Threads.RECEPIENT_IDS. In that column, I can have rows like: 4,10,25,60 or 2,4,8,20 or just 4. How would I query all rows that contain a 4 or query for all instances that a row contains a 4 or 20. I thought of something like:
String queryString = "'4','%,4','4,%','%,4,%','20','%,20','20,%','%,20,%'";
I just can't figure out why this doesn't return any rows. My parameters and cursorLoader is below.
private final String[] threadsProjection = new String[] { Treads.RECIPIENT_IDS };
private final String threadsSelection = Threads.RECIPIENT_IDS + " like ?";
private final String threadsOrder = Threads.DATE + " DESC";
@Override
public Loader<Cursor> onCreateLoader(int loaderID, Bundle bundle) {
switch (loaderID) {
case SMS_MMS_QUERY:
String queryString = bundle.getString(BUNDLE_QUERY_KEY);
CursorLoader queryCursorLoader = new CursorLoader(context, conversationsUri, threadsProjection, threadsSelection, new String[]{queryString}, threadsOrder);
return queryCursorLoader;
default:
return null;
}
}
Aucun commentaire:
Enregistrer un commentaire