Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
5a6ba1fc
Commit
5a6ba1fc
authored
Mar 17, 2023
by
Kazuyuki Hida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NullPointerExceptionの発生源にnullチェックを入れた。
parent
c3c89a45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/environment/DeviceInfo.java
+16
-3
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/environment/DeviceInfo.java
View file @
5a6ba1fc
...
...
@@ -80,9 +80,22 @@ public class DeviceInfo {
ActivityManager
am
=
(
ActivityManager
)
context
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
//noinspection deprecation(API21から非推奨になった。無視)
List
<
RunningTaskInfo
>
list
=
am
.
getRunningTasks
(
1
);
ComponentName
cn
=
list
.
get
(
0
).
topActivity
;
String
name
=
cn
.
getPackageName
();
return
name
.
indexOf
(
context
.
getPackageName
())
>
-
1
;
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
ComponentName
cn
=
list
.
get
(
0
).
topActivity
;
if
(
cn
!=
null
)
{
String
name
=
cn
.
getPackageName
();
if
(
name
!=
null
)
{
return
name
.
contains
(
context
.
getPackageName
());
}
else
{
Logger
.
d
(
TAG
,
"packageName is null"
);
}
}
else
{
Logger
.
d
(
TAG
,
"ComponentName is null"
);
}
}
else
{
Logger
.
d
(
TAG
,
"getRunningTasks is empty"
);
}
return
false
;
}
private
static
boolean
isEmulator
()
{
...
...
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