Exemplo n.º 1
0
 public static ArchitectFragment newInstance(int listN, String fileNameArchit, String dirName) {
   ArchitectFragment af = new ArchitectFragment();
   Bundle bundle = new Bundle();
   bundle.putInt("listnum", listN);
   bundle.putString("fileNameArchit", fileNameArchit);
   bundle.putString("dirName", dirName);
   af.setArguments(bundle);
   return af;
 }
Exemplo n.º 2
0
  // 显示详细数据
  public void showDetail(int group, int child) {
    FragmentManager fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment fragmentdetail;

    Fragment heroFragment = HeroFragment.newInstance(child, fileNameHero, dirName);
    Fragment unitFragment = UnitFragment.newInstance(child, fileNameUnit, dirName);
    Fragment architectFragment = ArchitectFragment.newInstance(child, fileNameArchitect, dirName);

    switch (group) {
      case 0:
        fragmentdetail = heroFragment;
        break;
      case 1:
        fragmentdetail = unitFragment;
        break;
      case 2:
        fragmentdetail = architectFragment;
        break;
      default:
        fragmentdetail = architectFragment;
        break;
    }

    ft.replace(R.id.detail_undead, fragmentdetail);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    ft.addToBackStack(null);
    ft.commit();
  }