title: An unhandled exception occured in TabView in Xamarin Android in VS2012
body: <pre><code>    **An unhandled exception occurred in Tab View in Xamarin Android in VS2012**
  
      **This is my layout main.axml**
  </code></pre>
  
  <p>i have no knowledge tab view implement in Xamarin using c# and use vs2012 so please help me this error occurred i when run my application in android emulator in visual studio alert box unhandled exception  </p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;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"&gt;
          &lt;LinearLayout
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:padding="5dp"&gt;
              &lt;TabWidget
                  android:id="@android:id/tabs"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content" /&gt;
              &lt;FrameLayout
                  android:id="@android:id/tabcontent"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:padding="5dp" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/TabHost&gt;
  </code></pre>
  
  <p><strong>this is my MainActiviy Activity1.cs</strong></p>
  
  <pre><code>    using System;
  
      using Android.App;
      using Android.Content;
      using Android.Runtime;
      using Android.Views;
      using Android.Widget;
      using Android.OS;
  
      namespace TabView 
      {
          [Activity(Label = "TabView", MainLauncher = true, Icon = "@drawable/icon")]
          public class Activity1 : TabActivity
          {
  
  
              protected override void OnCreate(Bundle bundle)
              {
                  base.OnCreate(bundle);
  
                  // Set our view from the "main" layout resource
                  SetContentView(Resource.Layout.Main);
                  CreateTab(typeof(WhatsOnActivity), "whats_on", "What's On", Resource.Drawable.ic_tab_whats_on);
                  CreateTab(typeof(SpeakersActivity), "speakers", "Speakers", Resource.Drawable.ic_tab_speakers);
                  CreateTab(typeof(SessionsActivity), "sessions", "Sessions", Resource.Drawable.ic_tab_sessions);
                  CreateTab(typeof(MyScheduleActivity), "my_schedule", "My Schedule", Resource.Drawable.ic_tab_my_schedule);
  
              }
              private void CreateTab(Type activityType, string tag, string label, int drawableId)
              {
                  var intent = new Intent(this, activityType);
                  intent.AddFlags(ActivityFlags.NewTask);
  
                  var spec = TabHost.NewTabSpec(tag);
                  var drawableIcon = Resources.GetDrawable(drawableId);
                  spec.SetIndicator(label, drawableIcon);
                  spec.SetContent(intent);
  
                  TabHost.AddTab(spec);
              }
  
  
              }
          }
  </code></pre>
  
  <blockquote>
    <p><strong><em>i want to four tab in my application</em></strong></p>
  </blockquote>
  
  <pre><code>    **this 1st tab activity MyScheduleActivity.cs**
  
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
  
      using Android.App;
      using Android.Content;
      using Android.OS;
      using Android.Runtime;
      using Android.Views;
      using Android.Widget;
  
      namespace TabView
      {
          [Activity]
          public class MyScheduleActivity : Activity
          {
              protected override void OnCreate(Bundle bundle)
              {
                  base.OnCreate(bundle);
  
                  TextView textview = new TextView(this);
                  textview.Text = "This is the My Schedule tab";
                  SetContentView(textview);
              }
          }
      }
  
  
      **this is 2nd activity SessionsActivity.cs**
  
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
  
      using Android.App;
      using Android.Content;
      using Android.OS;
      using Android.Runtime;
      using Android.Views;
      using Android.Widget;
  
      namespace TabView
      {
          [Activity]
          public class SessionsActivity : Activity
          {
              protected override void OnCreate(Bundle bundle)
              {
                  base.OnCreate(bundle);
  
                  TextView textview = new TextView(this);
                  textview.Text = "This is the My Session tab";
                  SetContentView(textview);
              }
          }
      }
  
  
      **this is 3rd activity SpeakersActivity.cs**
  
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
  
      using Android.App;
      using Android.Content;
      using Android.OS;
      using Android.Runtime;
      using Android.Views;
      using Android.Widget;
  
      namespace TabView
      {
          [Activity]
          public class SpeakersActivity : Activity
          {
              protected override void OnCreate(Bundle bundle)
              {
                  base.OnCreate(bundle);
  
                  TextView textview = new TextView(this);
                  textview.Text = "This is the My Speakers tab";
                  SetContentView(textview);
              }
          }
      }
  
  **this is 4th activity WhatsOnActivity.cs**
  
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  using Android.App;
  using Android.Content;
  using Android.OS;
  using Android.Runtime;
  using Android.Views;
  using Android.Widget;
  
  namespace TabView
  {
      [Activity]
      public class WhatsOnActivity : Activity
      {
          protected override void OnCreate(Bundle bundle)
          {
              base.OnCreate(bundle);
  
              TextView textview = new TextView(this);
              textview.Text = "This is the My Whats On tab";
              SetContentView(textview);
          }
      }
  }
  
  
  **AND**
  
  **this is my xml in  Resources=&gt;drawable folder** 
  
  1) ic_tab_my_schedule.xml
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item android:drawable="@drawable/ic_tab_my_schedule" android:state_selected="true"/&gt;
    &lt;item android:drawable="@drawable/ic_tab_my_schedule"/&gt;
  &lt;/selector&gt;
  
  
  2)ic_tab_sessions.xml
  &lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item android:drawable="@drawable/ic_tab_sessions"
          android:state_selected="true"/&gt;
    &lt;item android:drawable="@drawable/ic_tab_sessions"/&gt;
  &lt;/selector&gt;
  
  3)ic_tab_speakers.xml
  &lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item android:drawable="@drawable/ic_tab_speakers"
          android:state_selected="true"/&gt;
    &lt;item android:drawable="@drawable/ic_tab_speakers"/&gt;
  &lt;/selector&gt;
  
  4)ic_tab_whats_on.xml
  &lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item android:drawable="@drawable/ic_tab_whats_on"
          android:state_selected="true"/&gt;
    &lt;item android:drawable="@drawable/ic_tab_whats_on"/&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>and i added two images in drawable folder selected state and unselected state!</p>
  
  <p>and i follow this link :-<a href="http://docs.xamarin.com/guides/android/user_interface/tab_layout/tabbed_host_walkthrough" rel="nofollow">TabHost Walkthrough</a></p>
  
  <p>thakns in advance
  please i hope your response..</p>