Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy Cleaner Junk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Easy Cleaner Junk
Commits
29eb8124
Commit
29eb8124
authored
Jul 03, 2024
by
leichao.gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复崩溃
parent
ac227a86
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
MediaStoreUtils.java
.../com/test/easy/easycleanerjunk/helps/MediaStoreUtils.java
+7
-5
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/helps/MediaStoreUtils.java
View file @
29eb8124
...
@@ -52,9 +52,10 @@ public class MediaStoreUtils {
...
@@ -52,9 +52,10 @@ public class MediaStoreUtils {
String
path
=
cursor
.
getString
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
DATA
));
String
path
=
cursor
.
getString
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
DATA
));
long
size
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
SIZE
));
long
size
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
SIZE
));
long
createTime
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
DATE_ADDED
));
// 获取文件创建时间
long
createTime
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
DATE_ADDED
));
// 获取文件创建时间
Log
.
d
(
"glc"
,
"size: "
+
size
);
if
(!
TextUtils
.
isEmpty
(
name
)
&&
!
TextUtils
.
isEmpty
(
path
))
{
fileList
.
add
(
new
FileBean
(
name
,
path
,
size
,
false
,
getFileExtension
(
name
),
createTime
,
false
));
fileList
.
add
(
new
FileBean
(
name
,
path
,
size
,
false
,
getFileExtension
(
name
),
createTime
,
false
));
}
}
}
cursor
.
close
();
cursor
.
close
();
}
}
}
else
{
}
else
{
...
@@ -66,9 +67,10 @@ public class MediaStoreUtils {
...
@@ -66,9 +67,10 @@ public class MediaStoreUtils {
String
path
=
cursor
.
getString
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
DATA
));
String
path
=
cursor
.
getString
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
DATA
));
long
size
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
SIZE
));
long
size
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
SIZE
));
long
createTime
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
DATE_ADDED
));
// 获取文件创建时间
long
createTime
=
cursor
.
getLong
(
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
DATE_ADDED
));
// 获取文件创建时间
if
(!
TextUtils
.
isEmpty
(
name
)
&&
!
TextUtils
.
isEmpty
(
path
))
{
fileList
.
add
(
new
FileBean
(
name
,
path
,
size
,
false
,
getFileExtension
(
name
),
createTime
,
false
));
fileList
.
add
(
new
FileBean
(
name
,
path
,
size
,
false
,
getFileExtension
(
name
),
createTime
,
false
));
}
}
}
cursor
.
close
();
cursor
.
close
();
}
}
}
}
...
@@ -84,7 +86,7 @@ public class MediaStoreUtils {
...
@@ -84,7 +86,7 @@ public class MediaStoreUtils {
private
static
String
getFileExtension
(
String
fileName
)
{
private
static
String
getFileExtension
(
String
fileName
)
{
String
extension
=
"unknown"
;
String
extension
=
"unknown"
;
if
(
TextUtils
.
isEmpty
(
fileName
))
{
if
(
TextUtils
.
isEmpty
(
fileName
))
{
return
extension
;
return
extension
;
}
}
int
i
=
fileName
.
lastIndexOf
(
'.'
);
int
i
=
fileName
.
lastIndexOf
(
'.'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment