title: Xamarin app has stopped
body: <p>I have implemented a project in Xamarin.On running it on emulator and as well as on device, it shows that Unfortunately, App has stopped.</p>
  
  <p>I'm newbie to xamarin and I'm clueless with this issue.
  I've resolved all the errors and warnings but it shows like that only.</p>
  
  <p>My device catlog is as follows:
  <a href="https://i.stack.imgur.com/pShxk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pShxk.png" alt="enter image description here"></a></p>
  
  <p>custom spinner.cs</p>
  
  <pre><code>namespace App1.Assets.Ccode.Cspinner
  {
  
  
      class CustomSpinner : BaseAdapter
      {
          private Context c;
          private JavaList&lt;CountryName&gt; countries;
          private LayoutInflater inflater;
  
          public CustomSpinner(Context c, JavaList&lt;CountryName&gt; countries)
          {
              this.c = c;
              this.countries = countries;
          }
  
          public override Java.Lang.Object GetItem(int position)
          {
              return countries.Get(position);
          }
  
          public override long GetItemId(int position)
          {
              return position;
          }
  
          public override View GetView(int position, View convertView, ViewGroup parent)
          {
              if (inflater == null)
              {
                  inflater = (LayoutInflater)c.GetSystemService(Context.LayoutInflaterService);
              }
  
              if (convertView == null)
              {
                  convertView = inflater.Inflate(Resource.Layout.country_list, parent, false);
              }
  
              TextView nameTxt = convertView.FindViewById&lt;TextView&gt;(Resource.Id.nameTxt);
              ImageView img = convertView.FindViewById&lt;ImageView&gt;(Resource.Id.India);
  
              //BIND
              nameTxt.Text = countries[position].Name;
              img.SetImageResource(countries[position].Image);
  
  
              return convertView;
          }
  
          public override int Count
          {
              get
              {
                  return countries.Size();
              }
          }
  
      }
    }
    }
  </code></pre>
  
  <p>Main activiy</p>
  
  <pre><code>[Activity(Label = "App1", MainLauncher = true, Icon = "@drawable/icon")]
  public class MainActivity : Activity
  {
      private Spinner sp;
      private CustomSpinner adapter;
      private JavaList&lt;CountryName&gt; countries;
  
      protected override void OnCreate(Bundle bundle)
      {
          base.OnCreate(bundle);
  
          // Set our view from the "main" layout resource
          SetContentView(Resource.Layout.Main);
  
          sp = FindViewById&lt;Spinner&gt;(Resource.Id.country);
          countries = CountriesList.GetCountrys();
          adapter = new CustomSpinner(this, countries);
  
          sp.Adapter = (ISpinnerAdapter)adapter;
          sp.ItemSelected += sp_ItemSelected;
      }
  
      void sp_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
      {
          Toast.MakeText(this, countries[e.Position].Name, ToastLength.Short).Show();
      }
  }
  }
  </code></pre>
  
  <p>Manifest file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="App1.App1" android:versionCode="1" android:versionName="1.0"
  android:installLocation="auto"&gt;
  &lt;uses-sdk android:minSdkVersion="16" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;application android:label="App1"&gt;&lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Please save my day and help me to run it on device.</p>
  
  <p>Thank you</p>