public void checkBackStackAlreadyPresent()
{
int fragmentCount = getSupportFragmentManager().getBackStackEntryCount();
if (fragmentCount != 0) {
if (getSupportFragmentManager().getBackStackEntryAt(fragmentCount - 1).getName().equals("LocationSearch")) {
getSupportFragmentManager().popBackStack();
} else {
clearStack();
}
}
if (getSupportFragmentManager().getBackStackEntryAt(fragmentCount - 1).getName().equals("LocationSearch")) {
getSupportFragmentManager().popBackStack();
} else {
clearStack();
}
}
}
public void addFragment(){
//flightDatePickerFragment = null;
FragmentTransaction fragmentTransaction = getSupportFragmentManager()
.beginTransaction();
fragmentTransaction.setCustomAnimations(R.anim.slide_in_bottom,
R.anim.slide_up_from_bottom);
fragmentTransaction.replace(R.id.secondarycontent_frame,
locationSearchFragment);
fragmentTransaction.addToBackStack("LocationSearch");
fragmentTransaction.commit();
FragmentTransaction fragmentTransaction = getSupportFragmentManager()
.beginTransaction();
fragmentTransaction.setCustomAnimations(R.anim.slide_in_bottom,
R.anim.slide_up_from_bottom);
fragmentTransaction.replace(R.id.secondarycontent_frame,
locationSearchFragment);
fragmentTransaction.addToBackStack("LocationSearch");
fragmentTransaction.commit();
}
No comments:
Post a Comment