Ejemplo n.º 1
0
 private void clearBackStack() {
   FragmentManager fragmentManager = MainActivity.getInstance().getSupportFragmentManager();
   int count = fragmentManager.getBackStackEntryCount();
   if (count > 0) {
     BackStackEntry entry = fragmentManager.getBackStackEntryAt(0);
     fragmentManager.popBackStack(entry.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
     popAllFragment();
   }
 }
Ejemplo n.º 2
0
  public boolean closeFragment() {
    try {
      FragmentManager fragmentManager = MainActivity.getInstance().getSupportFragmentManager();
      int count = fragmentManager.getBackStackEntryCount();
      if (count > 0) {
        BackStackEntry entry = fragmentManager.getBackStackEntryAt(count - 1);

        fragmentManager.popBackStack(entry.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
        popFragment(1);
        return true;
      }
    } catch (Exception e) {
    }

    return false;
  }
Ejemplo n.º 3
0
 private boolean naviMainFragment(String ftag) {
   FragmentManager fragmentManager = MainActivity.getInstance().getSupportFragmentManager();
   int count = fragmentManager.getBackStackEntryCount();
   for (int i = 0; i < count; i++) {
     BackStackEntry entry = fragmentManager.getBackStackEntryAt(i);
     if (entry != null && !TextUtils.isEmpty(ftag) && entry.getName().contains(ftag)) {
       if (i < count - 1) {
         BackStackEntry topEntry = fragmentManager.getBackStackEntryAt(i + 1);
         fragmentManager.popBackStack(topEntry.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
         popFragment(fragmentStack.size() - i - 1);
       }
       return true;
     }
   }
   return false;
 }