Qing Ryder

Qing Ryder

  • NA
  • 202
  • 17.6k

Xamarin Development: Trying to Create a Spinner

Apr 6 2018 9:13 AM
Hello,
can Someone help me out on this?
an trying to create a spinner on my recent project in Xamarin using the example on https://docs.microsoft.com/en-us/xamarin/android/user-interface/controls/spinner and i get a red curly line error.
i dont know what i have done wrong. please someone help me out.
find screenshot attached
 
 
here is the code
  1. protected override void OnCreate(Bundle bundle)  
  2.        {  
  3.            base.OnCreate(bundle);  
  4.   
  5.            SetContentView(Resource.Layout.Homepage);  
  6.            Spinner spinner = FindViewById<Spinner>(Resource.Id.spinner1);  
  7.   
  8.            spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);  
  9.            var adapter = ArrayAdapter.CreateFromResource(  
  10.                    this, Resource.Array.Initial_array, Android.Resource.Layout.SimpleSpinnerItem);  
  11.            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);  
  12.            spinner.Adapter = adapter; 
 

Answers (5)