Question

Hi this is the query I use to view images from selected folder. Now I still want to view images only less than 1Mb is it possible. I think its possible using MediaStore.Images.Media.SIZE inside the code

String[] columns = { MediaStore.Images.Media.DATA, MediaStore.Images.Media._ID };
imagecursor=managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns,MediaStore.Images.Media.DATA + " like ? ", new String[] {"%/"+foldername+"/%"},null);
Was it helpful?

Solution

You can use like below. it will give you no. of image less than 1 MB.

final String[] columns = { MediaStore.Images.Media.DATA, MediaStore.Images.Media.SIZE
                         };
Cursor imagecursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns,MediaStore.Images.Media.SIZE + " < ? ",
                        new String[] {"1024"},null); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top