How to manage activity stack?
问题 When my stack is in this situation: A->B->C if I start D activity, I want that the activity stack becomes: A->D Note that activity C is a dialog. 回答1: here are the steps which will do the needed: from activity C launch the activity A with a boolean fromActivityC bundled with the intent and the flag FLAG_ACTIVITY_CLEAR_TOP set . Now in the on create of the activity A check for this boolean "fromActivityC" first and if present launch the activity D else the normal flow continues. // following