user5680859
user5680859

Reputation:

Cannot convert from android.support.v4.app.Fragment to android.app.Fragment in xamarin MVVMCROSS

Hey in android(Xamarin) I am trying to add tabs in actionbar and that I done but when I use the toggle button so this error shows

'FragmentTransaction' is an ambiguous reference between 'Android.App.FragmentTransaction' and 'Android.Support.V4.App.FragmentTransaction'

here is my code

protected override void OnCreate(Bundle bundle)
    {

        DrawerLayout mDrawerLayout;

        base.OnCreate(bundle);

        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.Main);

        mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);

        mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, Resource.Drawable.drawer, Resource.String.open_drawer, Resource.String.close_drawer); 


        FragmentTransaction transaction = FragmentManager.BeginTransaction();
        SlidingTabsFragment fragment = new SlidingTabsFragment();
        transaction.Replace(Resource.Id.sample_content_fragment, fragment);
        transaction.Commit();

        mDrawerLayout.SetDrawerListener(mDrawerToggle);
        ActionBar.SetDisplayHomeAsUpEnabled(true);
        ActionBar.SetHomeButtonEnabled(true);

    }

Upvotes: 1

Views: 1081

Answers (1)

user5680859
user5680859

Reputation:

use Android.App.FragmentTransaction transaction = FragmentManager.BeginTransaction();

Upvotes: 1

Related Questions