Reputation: 51
I am using this code:
SetContentView (Resource.Layout.Results);
// Create your application here
string[] listResults = Intent.GetStringArrayExtra ("resultData");
LinearLayout linear = FindViewById<LinearLayout> (Resource.Id.linear);
TextView resultsPaste = FindViewById<TextView> (Resource.Id.resultsPaste);
foreach(string item in listResults) {
resultsPaste.Text += item;
};
And I am receiving Object reference not set to an instance of an object
next to the foreach
. I have researched and can't find anything on it.
Why am I receiving the error?
Upvotes: 3
Views: 14049
Reputation: 3250
listResults, resultsPaste or both are null. Put a breakpoint before foreach and check the variables.
Upvotes: 3