How to kill an Android activity when leaving it so that it cannot be accessed from the back button?
You just need to call finish()
Intent intent = new Intent(this, NextActivity.class);
startActivity(intent);
finish();
Setting android:noHistory="true"
on the activity in your manifest will remove an activity from the stack whenever it is navigated away from. see here
you can use:
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);