mrhands mrhands - 2 years ago 93
Android Question

How to finish Activity when starting other activity in Android?

I have problems to finish the activity before. I want to start another activity and finish the current activity. When I used

it didn't exit the current activity.

How can I exit the activity before?

Answer Source

You need to intent your current context to another activity first with startActivity. After that you can finish your current activity from where you redirect.

 Intent intent = new Intent(this, FirstActivity.Class);
    finish(); // Call once you redirect to another activity
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download