hap497
hap497

Reputation: 162955

A Way to kill an activity in Android

In my android application, I start another activity using 'startActivity'. Is there anyway for me to kill that activity I started?

Thank you.

Upvotes: 1

Views: 7539

Answers (2)

Dan Lew
Dan Lew

Reputation: 87420

You can stop the other activity by calling Activity.finish(). Alternatively, you can use Activity.finishActivity() to finish an activity started by startActivityForResult().

Upvotes: 5

Bill Gary
Bill Gary

Reputation: 3005

When you start the new activity, the old activity goes onPause(). you could try calling finish() in the onPause() of the old activity.

Upvotes: 1

Related Questions