Carlo
Carlo

Reputation: 1177

How to clear the previous activity after starting new activity

Hello guys Im having a problem in how to clear the previous activity after starting new activity

I already try this code but it doesn't work when I press back button

here are the code ive tried

startActivity(new Intent(this, ErrorActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));

are they any other ways to do it or something missing from my code ?? I appreciate the for your reply thx

Upvotes: 2

Views: 581

Answers (1)

Nataliia.dev
Nataliia.dev

Reputation: 2972

Try to call finish() function.

Upvotes: 8

Related Questions