我有两个活动,“A”和“B”,“A”打开“B”。当用户点击活动“B”上的后退按钮时,我不想看到“A”,我只想关闭“A”。所以在“B”上我这样做了:
@Override
public void finish() {
// TODO Auto-generated method stub
Intent intent = new Intent(this, LoginActivity.class).putExtra(TAG, TAG).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
//super.finish();
}
在活动“A”中,我这样做了:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getIntent().getExtras() != null)
if(getIntent().getStringExtra(HomeActivity.TAG) != "")
finish();
}
它工作得很好,但我得到了这个例外:
E/ActivityThread(11115): Activity br.com.pedmobiledroid.view.controller.LoginActivity has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@42045be0 that was originally registered here. Are you missing a call to unregisterReceiver()?
有人知道正确执行此操作的更好方法吗?