Android 如果启动了错误的活动,我如何修复它?
我想在更新用户帐户的电子邮件或密码后启动登录活动。问题是,当我单击update按钮时,启动的活动是最后一个(MainActivity)Android 如果启动了错误的活动,我如何修复它?,android,Android,我想在更新用户帐户的电子邮件或密码后启动登录活动。问题是,当我单击update按钮时,启动的活动是最后一个(MainActivity) Intent i=newintent(getApplicationContext(),LoginActivity.class); 星触觉(i)登录活动立即在此处启动主活动: sharedPreferencesConfigs=new SharedPreferencesConfigs(getApplicationContext()); if(sha
Intent i=newintent(getApplicationContext(),LoginActivity.class);
星触觉(i)代码>登录活动立即在此处启动主活动:
sharedPreferencesConfigs=new SharedPreferencesConfigs(getApplicationContext());
if(sharedPreferencesConfigs.ReadLoginStatus()){
startActivity(new Intent(getApplicationContext(),MainActivity.class));
finish();
}
为了避免这种情况,请确保SharedReferencesConfigs.ReadLoginStatus()
返回false
请共享LoginActivitycheck的onCreate()函数代码,以查看在setContentView()方法中传递的布局。请检查AndroidManifest.xml。您的LoginActivity可能未在那里注册。我的LoginActivity已在AndroidManifest.xml中注册