In my android app I have a search interface where each list item can be clicked which launches a new Activity which displays more info on that single item. I have a back button on the New Activity which I would like to go back to the search results list. I’ve tried an intent that goes back to the searchpage, but that starts a new search:
Intent backIntent = new Intent(v.getContext(), SearchPage2.class);
backIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivityForResult(backIntent, 0);
SearchTaDa.this.finish();
I’ve also tried just SearchTaDa.this.finish(); and finish(); but both of these closes the whole app. Does anybody know how I can get back to the search results with a Back button click?
do not use this code because it removes all the activities which are in the stack
Use this code instead: