android java how to stop users fromgoing back too much

Java
// siyanda zama
    @Override
    public void onBackPressed() {
        moveTaskToBack(true);
    }

Source

Also in Java: