I found the solution:
- Activity A starts activity B with extra parameter (intent.putExtra("something", true))
- Activity B:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getIntent().hasExtra("something") && getIntent().getBooleanExtra("something", false) {
//show activity B
setContentView(R.layout.activity_B);
} else {
//don't show activity B, start activity C
startActivityForResult(activity_C, ACTIVITY_NOT_INITIALIZED); //start activity C
}
}
//when came back from activity C, check if activity B was already initialized
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == ACTIVITY_NOT_INITIALIZED) {
//show activity B
setContentView(R.layout.activity_B);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…