コード例 #1
0
  // #### fragment ####
  private void showFragment(Fragments fragmentType, int index, String tagid) {
    switch (fragmentType) {
      case Tag:
        objFragment = FRAG_Tag.newInstance();
        break;
      case Config:
        objFragment = FRAG_Config.newInstance();
        break;
      case About:
        objFragment = FRAG_About.newInstance();
        break;
      case Detail:
        objFragment = FRAG_Details.newInstance(index, tagid);
        break;
      case Web:
        final String prefixUrl = mSharedpref.getString("cfg_web_url", "");

        if (prefixUrl.isEmpty()) {
          Toast.makeText(
                  this, "Please fill the web url in the configuration page.", Toast.LENGTH_SHORT)
              .show();
          return;
        } else objFragment = FRAG_Web.newInstance(index, tagid);
        break;
    }
    ft = getFragmentManager().beginTransaction();
    ft.replace(iLayout, objFragment);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    //		    if(iLayout == R.id.TagLayout && fragmentType.equals(Fragments.Detail))
    //		    	ft.addToBackStack(null);

    ft.commit();
  }
コード例 #2
0
 private void insertFragTag() {
   FragmentTransaction ftTag = getFragmentManager().beginTransaction();
   ftTag.replace(R.id.TagLayout, FRAG_Tag.newInstance());
   ftTag.commit();
 }