0

I'm using this code in my main page and I get this error above. How can I fix this? I don't know if it matters but I also installed appcompat v7. My platform is Xamarin with Visual Studio.

Here is my code:

 public class MainActivity : TabActivity //Here i get my error in TabActivity
{
    private void CreateTab(Type activityType, string tag, string label)
    {
        var intent = new Intent(this, activityType);
        intent.AddFlags(ActivityFlags.NewTask);

        var spec = TabHost.NewTabSpec(tag);

        spec.SetIndicator(label);
        spec.SetContent(intent);

        TabHost.AddTab(spec);
    }
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);


        SetContentView(Resource.Layout.Main);
        CreateTab(typeof(WhatsOnActivity), "Page1", "Page1");
        CreateTab(typeof(SpeakersActivity), "Page2", "Page2");
}

And my xml file:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@android:id/tabhost"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent">
 <LinearLayout
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:padding="5dp">
<TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
<FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp" />
</LinearLayout>
</TabHost>
DiH
  • 451
  • 2
  • 8
  • 18

0 Answers0