private void Spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string selectedspinner = spinner.GetItemAtPosition(e.Position) + ""; selectedspinnerPosition = e.Position; RightdrawerAdapter mAdapter = new RightdrawerAdapter(this, AlQuestionList, myitems, startingquestionposition, mRecycleView, selectedspinnerPosition); mAdapter.ItemClick += MAdapter_ItemClick; mRecycleView.SetAdapter(mAdapter); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.leftdrawer); // var myquestionlist = Intent.GetStringExtra("QuestionList"); var myquestionlist = DosTestFragment.myquestionlist; position = Intent.GetIntExtra("position", 0); drawerselelectedspinner = Intent.GetIntExtra("drawerselelectedspinner", 0); startingquestionposition = JsonConvert.DeserializeObject <List <int> >(Intent.GetStringExtra("startingquestionposition")); items = JsonConvert.DeserializeObject <List <string> >(Intent.GetStringExtra("items")); myitems.Add("All"); for (int i = 0; i < items.Count; i++) { myitems.Add(items[i]); } AlQuestionList = JsonConvert.DeserializeObject <List <List <questionmodel> > >(myquestionlist); Spinner spinner = FindViewById <Spinner>(Resource.Id.mytesttestSpinner); var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, myitems); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = adapter; if (TestInstruction.testInfoList[0].Duration > 0) { spinner.Enabled = false; } else { spinner.Enabled = true; } spinner.SetSelection(drawerselelectedspinner); spinner.ItemSelected += Spinner_ItemSelected; ivclose = FindViewById <LinearLayout>(Resource.Id.closeleftdrawer); ivclose.SetOnClickListener(this); mRecycleView = FindViewById <RecyclerView>(Resource.Id.leftdrawerlist); mLayoutManager = new GridLayoutManager(this, 6); mRecycleView.SetLayoutManager(mLayoutManager); RightdrawerAdapter mAdapter = new RightdrawerAdapter(this, AlQuestionList, myitems, startingquestionposition, mRecycleView, 0); mAdapter.ItemClick += MAdapter_ItemClick; mRecycleView.SetAdapter(mAdapter); // Create your application here }