Android内容提供程序游标查询

时间:2016-05-18 12:03:19

标签: android mysql android-contentprovider android-cursor

我正在使用Android的内置内容提供商android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI。

现在我有了

String[] sarray  = {"a" , "b" , "c" , "d"};`
String[] projection = {MediaStore.MediaColumns._ID , MediaStore.MediaColumns.DATA};
String selection = ?????? // My qestion

cursor = getContentResolver().query(uri, projection, null,
                    null , order);

那么如何编写我的光标行,以便选择All But But Not saray FROM MediaStore.MediaColumns._ID列。

1 个答案:

答案 0 :(得分:0)

试试这个:

String[] sarray  = {"a" , "b" , "c" , "d"};
    String[] projection = {MediaStore.MediaColumns._ID , MediaStore.MediaColumns.DATA};
    String selection =""+MediaStore.MediaColumns._ID+" !=? AND  "+MediaStore.MediaColumns._ID+"" +
            " !=? AND "+MediaStore.MediaColumns._ID+" !=? AND "+MediaStore.MediaColumns._ID+" !=?";

    cursor = getContentResolver().query(uri, projection, selection,
            sarray , order);