【发布时间】:2016-01-19 05:37:54
【问题描述】:
我的应用程序中有很多活动
因为我已经给出了这个
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
从其他活动返回主页
喜欢下面
如果我按下这三个按钮,所有菜单都可以正常工作 这是我的选项菜单
@覆盖 public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.abc) {
Intent mypIntent = new Intent(this, abc.class);
startActivity(mypIntent);
return true;
}
else if (id == R.id.web) {
Intent webIntent = new Intent(this, Web.class);
startActivity(webIntent);
return true;
}
else if (id == R.id.about) {
Intent aboutIntent = new Intent(this, About.class);
startActivity(aboutIntent);
return true;
}
.
.
.
..
return super.onOptionsItemSelected(item);
}
这里没有名为 id == R.id.login 或 id == R.id.home 的菜单,但它会在几天前登录它的回家活动
但是如果我按返回.. 操作返回将重定向到登录页面 Inst-ed of Home
我使用共享首选项为我的应用程序添加了一个登录页面。现在它是启动器活动。
在我的登录活动中,如果一旦用户登录,它应该每次都重定向到主页活动.. 并且工作正常..
但在操作栏上,当我按下箭头按钮时,它会重定向到空的登录页面.. 如果我按取消整个应用程序正在运行..我的凭据是安全的,除了这个操作栏..
更新
如果登录凭据成功重定向到应用程序启动时的主页活动,我也有给定意图,它每次都会检查
一切都很好,除了行动回来
如何解决这个问题...
【问题讨论】:
-
你的 HomeActivity 上有返回按钮吗?
-
主页活动中没有后退按钮.. 我还有更多其他活动.. 就像关于 ect 的网站...如果我按下它重定向到登录的操作栏中... ..在添加登录页面之前它会回家......但现在它重定向到启动器,即......登录......
-
wt是app的最小sdk吗?