标签:ring scan 数据库查询 数据库 next ike count rowid str
MediaProvider 操作。
1. 通过data查询出某个路径ID,然后查询其Parent未此ID的所有文件。
{
Log.e("zcxpre","rowId = start !!!22222222!");
String where1 = MediaStore.Files.FileColumns._ID + ">?"+ " AND " + MediaStore.Files.FileColumns.DATA + "=?";
String[] selectionArgs1 = null;
selectionArgs1 = new String[] { "1","/storage/emulated/0/test" };
try {
Log.e("zcxpre","rowId = start !!!!");
c = mProvider.query(limitUri, FILES_PRESCAN_PROJECTION,
where1, selectionArgs1, MediaStore.Files.FileColumns._ID, null);
if (c == null) {
Log.e("zcxpre","c == null) ");
return;
}
int num = c.getCount();
if (num == 0) {
Log.e("zcxpre","num == 0");
return;
}
long rowId = -1;
while (c.moveToNext()) {
rowId = c.getLong(0);
}
Log.e("zcxpre","rowId = "+rowId);
} catch (Exception e) {
Log.e("zcxpre","rowId = Exectpoiton e "+e);
}
}
2.直接使用like查询所有文件。
String where1 = MediaStore.Files.FileColumns._ID + ">?"+ " AND " + MediaStore.Files.FileColumns.DATA + " like ?";
String[] selectionArgs1 = null;
selectionArgs1 = new String[] { "1","/storage/emulated/0/tencent%" };
标签:ring scan 数据库查询 数据库 next ike count rowid str
原文地址:https://www.cnblogs.com/zCoderJoy/p/9031425.html