The selection parameter is just an SQL expression, so you can combine multiple predicates with AND:
managedQuery(..., ...DATA + " LIKE ? AND " + ...SIZE + " < ?",
new String[] { "%/"+foldername+"/%", "1024" }, ...);
Question
Hi I have 2 different codes
To show only images of size less than 1Mb is sizeCursor
final String[] columns = { MediaStore.Images.Media.DATA, MediaStore.Images.Media.SIZE,MediaStore.Images.Media._ID};
imagecursor=managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns,MediaStore.Images.Media.DATA + " like ? ", new String[] {"%/"+foldername+"/%"},null);
Cursor sizeCursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns,MediaStore.Images.Media.SIZE + " < ? ",new String[] {"1024"},null);
Now I want to combine both into a single query, like show the images less than 1MB from selected folder
Solution
The selection parameter is just an SQL expression, so you can combine multiple predicates with AND:
managedQuery(..., ...DATA + " LIKE ? AND " + ...SIZE + " < ?",
new String[] { "%/"+foldername+"/%", "1024" }, ...);