Skip to content Skip to sidebar Skip to footer

Android Can I Use Join At Mediastore Query

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? Than

Solution 1:

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 uniquebreak;
         case RIGHT:
             // handle case where a row in cursorB is uniquebreak;
         case BOTH:
             // handle case where a row with the same key is in both cursorsbreak;
     }
 }

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.

Solution 2:

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.

Post a Comment for "Android Can I Use Join At Mediastore Query"