Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

点击home或者back进去是loginActivity #12

Open
yk007 opened this issue Jul 10, 2019 · 1 comment
Open

点击home或者back进去是loginActivity #12

yk007 opened this issue Jul 10, 2019 · 1 comment

Comments

@yk007
Copy link

yk007 commented Jul 10, 2019

public static void onBackPressed(Activity a) {
Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
launcherIntent.addCategory(Intent.CATEGORY_HOME);
a.startActivity(launcherIntent);
}
这个方法在小米手机上总是返回到登录页面,我loginAcitivty和MainActivity都有android.intent.action.MAIN,感觉是这个导致的,需要怎么修改?请教大神

@ShihooWang
Copy link
Owner

Intent.ACTION_MAIN 表示程序入口,
Intent.CATEGORY_HOME 表示目标的Activity是HOME,一般指桌面。
你的intent是想返回桌面吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants