0

I am trying to query MediaStore 2 different ways. One is to show all images in folders that are not in the excluded list. The other is to only show folders in the excluded list. I can get all the folders to show up but I cant get the excluded folders to show or not show.

Here is the first query

Query{
uri=content://media/external/file
projection=[parent, bucket_display_name, count(*), _data, max(date_modified)]
selection='media_type=? or media_type=?) group by (parent) HAVING (_data NOT LIKE ? '
args=[1, 3, /storage/emulated/0/Test]
sortMode='bucket_display_name'
ascending='true'
limit='-1'}

That should show all folders EXCEPT for the excluded ones. "_data NOT LIKE /storage/emulated/0/Test"

I have tried like this as well

Query{
uri=content://media/external/file
projection=[parent, bucket_display_name, count(*), _data, max(date_modified)]
selection='media_type=? or media_type=?) group by (parent) HAVING (_data != ? '
args=[1, 3, /storage/emulated/0/Test]
sortMode='bucket_display_name'
ascending='true'
limit='-1'}

Using != instead of not like.

I have also tried with wildcard

args=[1, 3, %/storage/emulated/0/Test%]

but if I have a Test2 folder it shows as well which I do not want.

Then the only difference I use to show excluded is chaging != to = OR Not Like to Like.

Here is a list of the folders the cursor finds

D/Folder: FolderCursor - path: /storage/emulated/0/Misc
          FolderCursor - name: Misc
          FolderCursor - id: 1902
          FolderCursor - count: 3
          FolderCursor - dm: -1
          Folder: Pictures id: 6
D/Folder: FolderCursor - path: /storage/emulated/0/Pictures
          FolderCursor - name: Pictures
          FolderCursor - id: 6
          FolderCursor - count: 1792
          FolderCursor - dm: 1523304236
          Folder: Test id: 1900
D/Folder: FolderCursor - path: /storage/emulated/0/Test
          FolderCursor - name: Test
          FolderCursor - id: 1900
          FolderCursor - count: 1
          FolderCursor - dm: -1
          Folder: test2 id: 1906
          FolderCursor - path: /storage/emulated/0/test2
D/Folder: FolderCursor - name: test2
          FolderCursor - id: 1906
          FolderCursor - count: 3
          FolderCursor - dm: -1

Please help me figure out how to get results for folders with and without my excluded folders.

BigDX
  • 3,519
  • 5
  • 38
  • 52
  • You can see this post I think this can help you https://stackoverflow.com/questions/3498844/sqlite-string-contains-other-string-query. If you want check if contains test. Example Like "%test%" – Crammeur Jul 22 '18 at 16:08
  • Using wildcard "%" does work as i mentioned above but if I only want to show "Test" folder it doesn't because it also shows "Test2" folder when i use wildcard – BigDX Jul 22 '18 at 16:46

0 Answers0