Check out example codes for "kotlin return to previous activity". It will help you in understanding the concepts better.

Code Example 1

if you use fragment u should use

getActivity().onBackPressed();
if you use single activity u can use

finish();

Learn ReactJs, React Native from akashmittal.com