Pregunta

In Xamarin, how can I get the getSupportFragmentManager() for my own FragmentPagerAdapter?

Here is my code:

public class MainActivity : FragmentActivity
{
    protected override void OnCreate (Bundle bundle)
    {
        base.OnCreate (bundle);

        SetContentView (Resource.Layout.activity_main);

        ViewPager pager = (ViewPager) FindViewById(Resource.Id.viewPager);
        pager.Adapter = new MyPagerAdapter(getSupportFragmentManager());
    }
}

This is the error that I am getting:

Error CS0103: The name 'getSupportFragmentManager' does not exist in the current context

Can I please have some help to get this working?

Thanks in advance

¿Fue útil?

Solución

You shouldn't use method getSupportFragmentManager on Xamarin as it doesn't exist there at all, there is already a property SupportFragmentManager, so just use that one

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top