I have problems to finish the activity before. I want to start another activity and finish the current activity. When I used
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); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); // Call once you redirect to another activity