Thanks to pskink for his input. The answer is to use the 'IN' operator.
String[] ids; //The id's to constrain the cursor to
StringBuilder selection;
selection = Table.column._ID + " IN (";
for(int i = 0; i < ids.length(); i++) {
selection.append(ids[i]);
if(i < ids.length -1) {
selection.append( "," ) //Add an "," after each selection (except the last)
}
}
selection.append(")");
This is the equivalent of:
Selection = "Table.column._ID IN (ids[1], ids[2], ids[3], ...);
Which is much better than:
Selection = "Table.column._ID = ids[1] OR Table.column._ID = ids[2] OR Table.column._ID = ids[3] ...";