I have three activites EmpSearch, SearchResults and EmpDetails.
When i click on the search button in EmpSearch activity, I am sending the input values of EmpSearch activity to SearchResults activity using intent. In SearchResults activity, I am passing the received input values to backend(OData services) and displaying the result in Listview. When I click on Listview item, I will navigate to EmpDetails activity. When I click on the emulator back button in EmpDetails activity, I am able to see the List filled with data previously fetched in SearchResults activity. Upto now everything is working fine.
I am using swipe gesture to come to SearchResults activity from the Details activity as shown below:
@Override
public void onSwipe(int direction) {
String str = "";
switch (direction) {
case SimpleGestureFilter.SWIPE_RIGHT : str = "Swipe Right";
newPages();
break;
case SimpleGestureFilter.SWIPE_LEFT : str = "Swipe Left";
break;
case SimpleGestureFilter.SWIPE_DOWN : str = "Swipe Down";
break;
case SimpleGestureFilter.SWIPE_UP : str = "Swipe Up";
break;
}
}
private void newPages() {
Intent swipeRight = new Intent(this, SearchResults.class);
swipeRight.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(swipeRight);
finish();
}
Now, when I navigate back to SearchResults activity by swiping to the right side in EmpDetails activity, it is showing empty list in SearchResults activity. How can I get the same behavior as emulator back button.
Please help me.