Commit 29eb8124 authored by leichao.gao's avatar leichao.gao

修复崩溃

parent ac227a86
......@@ -52,8 +52,9 @@ public class MediaStoreUtils {
String path = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATA));
long size = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.SIZE));
long createTime = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATE_ADDED)); // 获取文件创建时间
Log.d("glc", "size: " + size);
fileList.add(new FileBean(name, path, size, false, getFileExtension(name), createTime, false));
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(path)) {
fileList.add(new FileBean(name, path, size, false, getFileExtension(name), createTime, false));
}
}
cursor.close();
}
......@@ -66,8 +67,9 @@ public class MediaStoreUtils {
String path = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATA));
long size = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.SIZE));
long createTime = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATE_ADDED)); // 获取文件创建时间
fileList.add(new FileBean(name, path, size, false, getFileExtension(name), createTime, false));
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(path)) {
fileList.add(new FileBean(name, path, size, false, getFileExtension(name), createTime, false));
}
}
cursor.close();
}
......@@ -84,7 +86,7 @@ public class MediaStoreUtils {
private static String getFileExtension(String fileName) {
String extension = "unknown";
if(TextUtils.isEmpty(fileName)){
if (TextUtils.isEmpty(fileName)) {
return extension;
}
int i = fileName.lastIndexOf('.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment