I have a case where I need to pop an activity from backstack based on a condition in the next activity. Say there are 3 activities A, B & C.

Activity A has a list and when user taps on a specific item activity B starts with a form that has many items. User fills the form(partial or complete) and can preview the same in activity C. Inside activity C he can confirm the details or simply go back to activity B and continue working on the form. What I want is activity B popped out of backstack if user taps "confirm" in activity C and pressing back button should take user to activity A instead of B.

Any help will be appreciated