I am creating a customized list in **xamarin android**

Here is my code:

```html
using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace FinalList
{
 [Activity (Label = "FinalList", MainLauncher = true, Icon = "@drawable/icon")]
 public class MainActivity :ListActivity
 {
  string[] items;
  protected override void OnCreate (Bundle bundle)
  {  

   base.OnCreate (bundle);
   items = new string[] { "aBulbs","bFliuits","cFruits","dpriraji","eqsbciob","frTubers","guhVegetables","hvwert","iwxamarin","jyaaaa","kVegetables","lFruits","mVegetables","nwert","pxamarin","ryaaaa"};
   //ListAdapter = new ArrayAdapter<String> (this, Android.Resource.Layout.SimpleListItem1, items);
   ListView lv =FindViewById<ListView> (Android.Resource.Id.List);
   ListAdapter = new HomeScreenAdapter(this, items);
   ListView.FastScrollEnabled = true;
   //listview.ChoiceMode = Android.Widget.ChoiceMode.Single;
     // listview.SetItemChecked (1, true);
   lv.SetItemChecked (3, true);
  }
  protected override void OnListItemClick(ListView l, View v, int position, long id)
  {
   var t = items[position];
   Android.Widget.Toast.MakeText(this, t, Android.Widget.ToastLength.Short).Show();
  }
 }
}
```

This is my axml file:

```html
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
   <ListView
     android:id="@+id/List"
     android:layout_height="match_parent"
     android:layout_width="match_parent"
     android:fastScrollEnabled="true"
     />
</LinearLayout>
```

and here is my `HomeScreenAdapter` file:

```html
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 FinalList
{
 [Activity (Label = "HomeScreenAdapter")]   
 public class HomeScreenAdapter : BaseAdapter<string>,ISectionIndexer {
  String[] items;
  Activity context;
  Dictionary<string, int> alphaIndex;
  String[] sections;
  Java.Lang.Object[] sectionsObjects;
  public HomeScreenAdapter(Activity context, string[] items) : base() {
   this.context = context;
   this.items = items;
    alphaIndex = new Dictionary<string, int>();
   for (int i = 0; i < items.Length; i++) { // loop through items
    String s = items [i];
    String key = s.Substring (0, 1);
    key= key.ToUpper ();
    if (!alphaIndex.ContainsKey(key))
     alphaIndex.Add(key, i); // add each 'new' letter to the index
   }
   sections = new string[alphaIndex.Keys.Count];
   alphaIndex.Keys.CopyTo(sections, 0); // convert letters list to string[]
   // Interface requires a Java.Lang.Object[], so we create one here
    sectionsObjects = new Java.Lang.Object[sections.Length];
   for (int i = 0; i < sections.Length; i++) {
    sectionsObjects[i] = new Java.Lang.String(sections[i]);
   }
  }
  public override long GetItemId(int position)
  {
   return position;
  }
  public override string this[int position] {  
   get { return items[position]; }
  }
  public override int Count {
   get { return items.Length; }
  }
  public override View GetView(int position, View convertView, ViewGroup parent)
  {
   View view = convertView; // re-use an existing view, if one is available
   if (view == null) // otherwise create a new one
    view = context.LayoutInflater.Inflate(Android.Resource.Layout.SimpleListItemChecked, null);
   view.FindViewById<TextView>(Android.Resource.Id.Text1).Text = items[position];
   return view;
  }
  public Java.Lang.Object[] GetSections()
  {
   return sectionsObjects;
  }
  public int GetPositionForSection(int section)
  {
   return alphaIndex[sections[section]];
  }
  public int GetSectionForPosition(int position)
  {      // this method isn't called in this example, but code is provided for completeness
   int prevSection = 0;
   for (int i = 0; i < sections.Length; i++)
   {
    if (GetPositionForSection(i) > position)
    {
     break;
    }
    prevSection = i;
   }
   return prevSection;
  }

 }
}
```

When I build solution I get **null object reference exception**
It says:

```
object reference is not set to an instance of an object at line
lv.setitemchecked(1,true);

```

How do I remove this exception?