Check out example codes for "android java how to stop users fromgoing back too much". It will help you in understanding the concepts better.

Code Example 1

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

Learn ReactJs, React Native from akashmittal.com