Fragment manager Getting into custom adapter

时间:2016-04-25 08:58:29

标签: android

In my Adapter I want to Navigate different fragments

  public NavAdapter(Context context, ArrayList<NavItems> navItems) {
    this.navItems = navItems;
    this.context = context;
   }

in above adapter Constructor I managed to get context , how to get the fragmentManager ?

1 个答案:

答案 0 :(得分:0)

  YourActivity mainActivity = (YourActivity) context;
  FragmentManager manager = mainActivity.getSupportFragmentManager();

You can use this to get FregmantManager and perform the transaction .