java - cursor.moveToFirst never returns true -


i'm trying search mediastore , far have had no luck in doing so.

here current code looks like:

    cursor cursor = this.managedquery(uri,                      null,                      mediastore.audio.media.title + "=?",                      new string[]{songtoplay},                      mediastore.audio.media.title + " asc");               if(cursor.movetofirst()){                 do{  string path = cursor.getstring(cursor.getcolumnindex(mediastore.audio.media.data));                 long id = cursor.getlong(cursor.getcolumnindex(mediastore.audio.media._id));                   test.settext(path);                 }             while (cursor.movetonext());              } 

songtoplay, uri correctly set.

the if statement never executed.

what cause this?

it means the cursor empty. try out cursor.getcount(), , double-check if query correct. sure media store populated? have permissions access it?

it looks building search functionality, way. if true, sure use operator, or better yet, use full text search.


Comments

Popular posts from this blog

c++ - End of file on pipe magic during open -

basic authentication with http post params android -

data.table making a copy of table in R -