Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
石璀亮
/
turingos
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 598076ec
authored
Aug 19, 2019
by
cuiliang.shi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
打开应用 FLAG_ACTIVITY_NEW_TASK
1 parent
26eadf74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
app/src/main/java/com/toscl/turingos/util/ApiResultCode.java
app/src/main/java/com/toscl/turingos/util/ApiResultCode.java
View file @
598076e
...
...
@@ -24,6 +24,15 @@ public class ApiResultCode {
public
static
void
doStartApplicationWithPackageName
(
String
packageName
,
Context
context
){
if
(
packageName
.
contains
(
"/"
)){
Intent
intentUsb
=
new
Intent
();
intentUsb
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
ComponentName
cpn
=
new
ComponentName
(
packageName
.
split
(
"/"
)[
0
],
packageName
.
split
(
"/"
)[
1
]);
intentUsb
.
setComponent
(
cpn
);
context
.
startActivity
(
intentUsb
);
return
;
}
//通过包名获取此App详细信息
PackageInfo
packageInfo
=
null
;
try
{
...
...
@@ -50,6 +59,8 @@ public class ApiResultCode {
Intent
intent
=
new
Intent
(
Intent
.
ACTION_MAIN
);
intent
.
addCategory
(
Intent
.
CATEGORY_LAUNCHER
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
//设置CompoentName
ComponentName
cn
=
new
ComponentName
(
packageName
,
className
);
intent
.
setComponent
(
cn
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment