获得使用SQLite查询吸走,这里是我的问题,采取MediaStore.Audio.Artist.Artist为例,Android的ContentProvider的查询条件问题
String[] projection={MediaStore.Audio.Artists._ID,MediaStore.Audio.Artists.ARTIST};
String selectionClause=MediaStore.Audio.Artists.ARTIST+" = ?";
String[] selectionArgs={"Artist1","Artist2"};
只想拿回匹配字符串“Artist1”的结果,并“Artist2”,但我得到像下面的错误,
Caused by: java.lang.IllegalArgumentException: Cannot bind argument at index 2 because the index is out of range. The statement has 1 parameters.
请告诉我这是什么错误,正确的方法来做,谢谢!
感谢您的回答,但不幸的是跟着你回答,cursoradapter不会被调用,不知道为什么? – Leon
我不确定你的意思是“不被称为”。请确保您的查询将返回有效的结果,然后逐步调试 –
抱歉,我的表达不是很清楚,我的意思是当使用ur的想法时,CursorAdapter的方法bindView将不会执行。我在bindView中设置了Log.e命令,并且发现Log.e未运行 – Leon