There is a need from one Activity to close another. How to do it?

  • one
    There is no need to close past activations from the current one independently, why are you going to do this? - pavlofff
  • Necessity happens ... There is the main thing activit, from it activit1 opens, and already from it activit2. When you click, for example, on the button in activit2, you need to close both activations both first and second and find yourself in the main thing - sitev_ru
  • 2
    @sitev_ru read about the activation stack and activation launch flags - developer.android.com/intl/ru/guide/components/… - temq
  • one
    To do this, you need to clear the stack of activations and explicitly call the main one of activit2 - you will start “all over again”. If more complex transition logic is required, see the link in the comment above. - pavlofff
  • Run activity2 via startActivityForResult() . In aktiviti2 when you click on the button perform setResult(OK); finish() setResult(OK); finish() . In activit1 in onActivityResult catch this result and execute finish () too - lsillarionov

0