Есть два способа. Первый это когда с первой активити запускаете второе добавить finish
startActivity(new Intent(FirstActivity.this, SecondActivity.class));
finish();
Второй способ добавить флаги
Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
Подробнее:
https://developer.android.com/reference/android/co...This launch mode can also be used to good effect in conjunction with FLAG_ACTIVITY_NEW_TASK: if used to start the root activity of a task, it will bring any currently running instance of that task to the foreground, and then clear it to its root state. This is especially useful, for example, when launching an activity from the notification manager.