Android - searching music using MediaStore using a string -
i can not accomplish on 2 weeks now.
i have posted numerous amount of code on few questions yet of them got ignored won't flood question more code of own won't read.
how search mediastore "like" attributes using string?
e.g. type in shoot thrill, receive song id code:
if(cursor.movetofirst()){ while(cursor.movetonext()){ string title = cursor.getstring(cursor.getcolumnindex(mediastore.audio.media.title)); string artist = cursor.getstring(cursor.getcolumnindex(mediastore.audio.media.artist)); string id = cursor.getstring(cursor.getcolumnindex(mediastore.audio.media._id)); test.settext(title +" " + artist + " " + id); } }
here begin with:
string[] projection = { basecolumns._id, mediastore.audio.artists.artist, mediastore.audio.media.title } cursor cursor = this.managedquery( mediastore.audio.media.external_content_uri, //uri projection, //projection //i dont know enter, //i dont know enter, mediastore.audio.media.title);
it's normal sql hiding behind scenes. normal operations should work fine. can use mediastore.audio.media.title + " \"%thrill%\""
other sql query.
string[] projection = { basecolumns._id, mediastore.audio.artists.artist, mediastore.audio.media.title }; string = mediastore.audio.media.title + " ?"; string[] params = new string[] { "%life%" }; cursor q = managedquery(mediastore.audio.media.external_content_uri, projection, where, params, mediastore.audio.media.title); try { while (q.movetonext()) { log.e("song", q.getstring(1) + " " + q.getstring(2)); } } { q.close(); }
Comments
Post a Comment