public static bool IsAnswerCorrect(SparseBooleanArray checkedItems, int[] answerIds) { if (checkedItems == null || answerIds == null) { Log.Info(Tag, "isAnswerCorrect got a null parameter input."); return false; } foreach (int answer in answerIds) { if (0 > checkedItems.IndexOfKey(answer)) { return false; } } return true; }
private void SetToAddress(object sender, EventArgs e) { List<string> PBT_selected = new List<string>(); List<string> ID_PBT_selected = new List<string>(); sparseArray = FindViewById<ListView> (Resource.Id.lvMSCMLPBTLpbt).CheckedItemPositions; string Pbt_Name_selected; string Pbt_ID_selected; for (var i = 0; i < sparseArray.Size (); i++) { string selectedValue = string.Empty; string ID_selected = string.Empty; int position = sparseArray.KeyAt(i); if (sparseArray.ValueAt (i) == true) { selectedValue = listView.GetItemAtPosition (position).ToString (); ID_selected = pbtListIDArray[position]; //groups.Remove (groups [position]); //Android.Widget.Toast.MakeText(this,"Subscribed for "+selectedValue, Android.Widget.ToastLength.Short).Show(); //searchGroupAdapter.NotifyDataSetChanged (); PBT_selected.Add(selectedValue); ID_PBT_selected.Add(ID_selected); } } Pbt_Name_selected = String.Join(" , ", PBT_selected); Pbt_ID_selected = String.Join(" , ", ID_PBT_selected); Intent intentToSend = new Intent(); intentToSend.PutExtra("PBT_Name",Pbt_Name_selected.ToString()); intentToSend.PutExtra("PBT_ID",Pbt_ID_selected.ToString()); SetResult(Result.Ok,intentToSend); this.Finish (); this.OverridePendingTransition (0, 0); }