I am developing an app in C# using Xamarin. I am trying to pass the text from check boxes through an intent to another page as check boxes. It appears on the other page but it makes a copy of each check box so instead of one being passed there are two of the same appearing on the page. I am not sure why this is. Any help would be greatly appreciated. Here is the code. for the first page that sends the intent.
//Get Results button
for (int i = 0; i < 460; i++)
myResources.result_count = 0;
myResources.check_indexSet = new List<int> ();
Button button01 = FindViewById<Button> (Resource.Id.button01);
button01.Click += delegate {
String aPhrases = "";
for (int i = 0; i < 460; i++)
if (cb_set[i].Checked) {
aPhrases = cb_set[i].Text;
};
var resultIntent = new Intent (this, typeof(results));
resultIntent.PutExtra ("CheckBoxData",aPhrases);
myResources.isLast = false;
myResources.isLoadingNow= false;
StartActivity (resultIntent);
};
Here is the code for the page that collects the intent and displays it.
view = FindViewById<LinearLayout> (Resource.Id.linearlayout0);
checkTextList = new List<String> ();
String checkTextSet = Intent.GetStringExtra ("CheckBoxData") ?? "";
if (checkTextSet == null || checkTextSet == "") {
} else {
String[] textSet = checkTextSet.Split (',');
checkTextList.AddRange (textSet);
}
0 comments:
Post a Comment