In Android, how do I query MediaStore only for files in a specific path? Or alternatively, only display files in a certain path?
<p>Suppose I have an Android block of code that looks something like this:</p>

<pre><code>String[] proj = {MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media._ID};
int[] to = new int[] { R.id.artist_name };
Cursor musiccursor = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, proj, null, null, MediaStore.Audio.Media.ARTIST);
ListView musiclist = (ListView) findViewById(R.id.mylist);

SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.songitem, musiccursor, proj, to);
musiclist.setAdapter(mAdapter);
</code></pre>

<p>But what I want, is this:</p>

<pre><code>String selection = MediaStore.Audio.Media.FILE_PATH + " ilike '%audio%books%'";

String[] proj = {MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media._ID};
int[] to = new int[] { R.id.artist_name };
Cursor musiccursor = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, proj, selection, null, MediaStore.Audio.Media.ARTIST);
ListView musiclist = (ListView) findViewById(R.id.mylist);

SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.songitem, musiccursor, proj, to);
musiclist.setAdapter(mAdapter);
</code></pre>

<p>The only problem, of course, is that FILE_PATH is not actually a column I can use, and as far as I can tell, no such column exists.</p>

<p>So I'm wondering:</p>

<ol>
<li>Is there a way to query only for music in a certain directory? If so, how?</li>
<li>If that's not an option, should I make a ListAdapter that filters by directory? If so, again, how would I go about in doing that?</li>
</ol>

<p>Thanks for any advice.</p>
