I do totally agree with the Navigation below

Imagine that the Book detail is made in different instances of a BookDetailActivity.
The stack before pressing up in book2 detail is:
- BookDetailActivity (Book 2 – You are here)
- BookDetailActivity (Book 1)
- AllBooksActivity
If I follow the guidelines I will use:
Intent parentActivityIntent = new Intent(this, AllBooksActivity.class);
parentActivityIntent.addFlags(
Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(parentActivityIntent);
finish();
But the big problem with this code is that BookDetailActivity (Book 1) is still alive!
Pressing back button after “up” would bring the detail of Book 1.
How can I kill all the BookDetailActivity that are between the original AllBooksActivity and the activity where I pressed up?
The related guidelines article notes the following:
Since you’re doing that, BookDetailActivity1 should be closed by FLAG_ACTIVITY_CLEAR_TOP. The only way if it could be alive and shown on pressing Back is if it would have been started before AllBooksActivity.
As for not needing FLAG_ACTIVITY_NEW_TASK (suggested by android developer‘s answer):
…so if your activity exists, it will not start a new task.