Android Activity.managedQuery selection and selectionArgs arguments
Most of the examples of managedQuery don't use the selection and selectionArgs arguments, others are pretty simple like : Cursor simple(String id) { return managedQuery(getIntent().getData(), PROJECTION, "id = " + id, null, DEFAULT_SORT_ORDER); } or Cursor simple(String id) { return managedQuery(getIntent().getData(), PROJECTION, "id = ?", new String [] ={id}, DEFAULT_SORT_ORDER); } Both of the above do exacly the same thing. The '?'s are the elements in the array in order they are placed. [ Resource ] I was working on a piece of code that stored IDs in SharedPreferences and then loaded the elements with those IDs into a ListView from a ContentProvider. Basically I was trying to get that : WHERE id IN ( id1, id2, id3, id4,...) So the selection argument looked like that : "id IN ( ? " + [",? "] + " )" and the selection args stored the ID of elements I wanted to load. SharedPreferences data = getSharedPref...