Hi if you are in a fragment and are not able to use the finish method as it is(because finish should solve your problem) then you can use the getActivity.finish() method after startActivity(intent);.
If you are not in a fragment you could directly use finish() after you startActivity(intent); line