private void getEbookList(){
String[] columns = new String[] {
MediaStore.Files.FileColumns.TITLE,
MediaStore.Files.FileColumns.DATA
};
Uri uri = MediaStore.Files.getContentUri("external");
String selection = "(" + MediaStore.Files.FileColumns.MIME_TYPE + "=='text/plain')";
Cursor c = getContentResolver().query(uri, columns, selection, null, MediaStore.Files.FileColumns.SIZE + " DESC");
if (c == null) return;
if (c.moveToFirst()) {
int dataIndex = c.getColumnIndex(MediaStore.Files.FileColumns.DATA);
int titleIndex = c.getColumnIndex(MediaStore.Files.FileColumns.TITLE);
do {
c.getString(titleIndex); // 获取文件名,不包含扩展名
c.getString(dataIndex); // 获取文件实际路径
} while (c.moveToNext()); // 循环获取文件
}
c.close();}