Android - How to end / end an Activity?

0

How do I close, finish, end a Activity , after executing a method?

In my project, I have two Activitys:

  • MainActivity
  • EditorActivity (Performs some simple tasks)

I would like to end it, after calling the last method that completes its task and thus, when it finishes, return to the main Activity.

    
asked by anonymous 24.02.2018 / 20:03

1 answer

1

I found the solution in @ valdeir-psr's commentary

Simply call the finish () method inside any activity method. Other redundant forms would be:

  • MainActivity.class.finish();
  • this.finish();
  • finish(); (The most correct)

link

    
24.02.2018 / 20:34