3

is there any method to use join in a query at mediastore data?

Or also is there any method to access the mediastore data through a database and not with the content provider?

Thank you.

javment
  • 368
  • 1
  • 5
  • 17

2 Answers2

4

But I think that you can use joins with content providers. If you make two queries, you can join them by using CursorJoiner. I am using it and it works good.

Snippet from Android docs:

CursorJoiner joiner = new CursorJoiner(cursorA, keyColumnsofA, cursorB, keyColumnsofB);
 for (CursorJointer.Result joinerResult : joiner) {
     switch (joinerResult) {
         case LEFT:
             // handle case where a row in cursorA is unique
             break;
         case RIGHT:
             // handle case where a row in cursorB is unique
             break;
         case BOTH:
             // handle case where a row with the same key is in both cursors
             break;
     }
 }

it is not exactly the same as SQL join but its useful. In each "case" you can manipulate with both cursors which are pointing to processed row.

Bhiefer
  • 1,613
  • 4
  • 16
  • 31
3

is there any method to use join in a query at mediastore data?

There are no JOINs possible with content provider queries, sorry.

Or also is there any method to access the mediastore data through a database and not with the content provider?

Only if you write your own firmware.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491