[英]Start activity after Resume
My start activity is a LoginView
. 我的开始活动是LoginView
。 If the login was correct i call startActivity(new Intent(LoginView.this, MainView.class));
如果登录正确,则调用startActivity(new Intent(LoginView.this, MainView.class));
and finish()
. 和finish()
。
So my App switch to the MainView
and if i press the back button the app goes to the backgroud. 因此,我的应用程序切换到MainView
,如果我按后退按钮,则该应用程序将进入背景。
My Problem: 我的问题:
If i resume the app (long press the home key) i always come back to the LoginView
and not to the Mainview
如果我继续使用该应用程序(长按主页键),我将始终返回到LoginView
而不是Mainview
MainView: 主视图:
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.mainlayout);
}
Please help 请帮忙
login.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{
String name=username.getText().toString();
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = settings.edit();
editor.putString("username", name);
if(name.equals("xxx"))
{
Intent intent=new Intent(currentactivity.this,nextactivity.class);
intent.putExtras(bundle);
startActivityForResult(intent,0);
}
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.