public static ItemListDisplayFragment newInstance(String itemName, String type) {
   ItemListDisplayFragment fragment = new ItemListDisplayFragment();
   Bundle args = new Bundle();
   args.putString(TYPE_ITEM, type);
   if (TYPE_CHANNEL.equals(type)) {
     args.putString(CHANNEL_NAME, itemName);
   } else {
     args.putString(PUSHER_NAME, itemName);
   }
   fragment.setArguments(args);
   return fragment;
 }
Exemplo n.º 2
0
 private void addFragment() {
   currentType = getIntent().getStringExtra(TYPE_ITEM);
   currentItemName = getIntent().getStringExtra(ITEM_NAME);
   getSupportActionBar().setTitle(currentItemName);
   fragmentManager = getSupportFragmentManager();
   FragmentTransaction ft = fragmentManager.beginTransaction();
   ItemListDisplayFragment fragment;
   if (TYPE_CHANNEL.equals(currentType)) {
     fragment =
         ItemListDisplayFragment.newInstance(
             currentItemName, ItemListDisplayFragment.TYPE_CHANNEL);
   } else {
     fragment =
         ItemListDisplayFragment.newInstance(currentItemName, ItemListDisplayFragment.TYPE_PUSHER);
   }
   ft.add(R.id.main_view, fragment);
   ft.commit();
 }