I'm not sure if this is the correct way of doing it, but I ended up doing it like this. I made two cursors and then wrapped them up with MergeCursor and then used that. Here's the code if it helps!
private String[] getAudioPath(String songTitle) {
final Cursor mInternalCursor = getContentResolver().query(
MediaStore.Audio.Media.INTERNAL_CONTENT_URI,
new String[] { MediaStore.Audio.Media.DISPLAY_NAME, MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.DATA },
MediaStore.Audio.Media.TITLE+ "=?",
new String[] {songTitle},
"LOWER(" + MediaStore.Audio.Media.TITLE + ") ASC");
final Cursor mExternalCursor = getContentResolver().query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
new String[] { MediaStore.Audio.Media.DISPLAY_NAME, MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.DATA },
MediaStore.Audio.Media.TITLE+ "=?",
new String[] {songTitle},
"LOWER(" + MediaStore.Audio.Media.TITLE + ") ASC");
Cursor[] cursors = {mInternalCursor, mExternalCursor};
final MergeCursor mMergeCursor = new MergeCursor(cursors);
int count = mMergeCursor.getCount();
String[] songs = new String[count];
String[] mAudioPath = new String[count];
int i = 0;
if (mMergeCursor.moveToFirst()) {
do {
songs[i] = mMergeCursor.getString(mMergeCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE));
mAudioPath[i] = mMergeCursor.getString(mMergeCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA));
i++;
} while (mMergeCursor.moveToNext());
}
mMergeCursor.close();
return mAudioPath;
}