Reputation: 37
I am using Xamarin android
I have Spinner , When I use the setAdapter
function I get this error
Error 3 'Android.Widget.Spinner' does not contain a definition for 'setAdepter' and no extension method 'setAdepter' accepting a first argument of type 'Android.Widget.Spinner' could be found (are you missing a using directive or an assembly reference?)
This is my code
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 FSF
{
[Activity(Label = "Request")]
public class RequestHolidayActivity : Activity
{
Spinner spinner_holidayType;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.RequestHoliday);
spinner_holidayType = FindViewById<Spinner>(Resource.Id.RequestHoliday_spinner_holidayT);
var items = new List<string>() { "first", "second", "third", "forth" };
var adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerItem, items);
spinner_holidayType.setAdepter(adapter);
}
}
}
I tried to solve it , but I didn't find a solution.
Upvotes: 1
Views: 348
Reputation: 2879
There is not SetAdapter method. Instead use the Adapter property and change your code to: spinner_holydayType.Adapter = adapter;
Upvotes: 3