Accessing ViewPager inside a fragment

I have a fragment that holds a viewpager and tablayout. I can access the tablayout from the fragment but when I try to do the same for the view pager it always returns null

//this is a method on the pagefragment 
    public override void OnActivityCreated(Bundle savedInstanceState)
    {
        base.OnActivityCreated(savedInstanceState);
      tabs = this.View.FindViewById<TabLayout>(Resource.Id.mytab);
       vp = (ViewPager) Activity.FindViewById(Resource.Id.myviewpage);

        SetUpViewPager(vp);
       tabs.SetupWithViewPager(vp);
    }

vp alway returns null so the app crashes when it get to SetUpViewPager(vp) but the the tabs is accessible

Sign In or Register to comment.