예제 #1
0
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
      if (fragment == null) {
        fragment = Fragment.instantiate(activity, clazz.getName());
        ft.add(android.R.id.content, fragment, tag);
      } else {
        ft.attach(fragment);
      }

      activity.setTitle(((StatsView<?>) fragment).getTitle());
      if (activity.appName != null) {
        activity.getActionBar().setSubtitle(activity.appName);
      }
    }
예제 #2
0
    public TabListener(DetailsActivity activity, String tag, Class<T> clz) {
      this.activity = activity;
      this.tag = tag;
      this.clazz = clz;

      fragment = activity.getFragmentManager().findFragmentByTag(tag);
    }