Problem: today, when simpleadapter is bound to the listview in the xamarin experiment, a crash occurs,
See the figure below:
Solution:
The constructor public simpleadapter (context, ilist <idictionary <string, Object> data, int resource, string [] From, int [] to) in simpleadapter) the second construction parameter ilist <idictionary <string, Object> data is an excuse, but I used the following code when creating an item:
VaR DATA = new list <idictionary <string, Object> ();
Idictionary <string, Object> item;
Item = new dictionary <string, Object> ();
Item. Add ("name", "Zhang San );
Item. Add ("sex", "male ");
Data. Add (item );
The modified code is as follows:
VaR DATA = new list <idictionary <string, Object> ();
Idictionary <string, Object> item;
Item = newJavadictionary<String, Object> ();
Item. Add ("name", "Zhang San );
Item. Add ("sex", "male ");
Data. Add (item );
Use the Android device logging tool that comes with vs2012 to view the following information:
Cause:
In vs2012, you cannot use the code to check for this problem. This is a running problem, but the exception cannot be thrown correctly. It can be seen through the Android device logging tool. It turns out that it is because of system. collections. generic. dictionary cannot be converted to Java at runtime. util. map, while Android. runtime. javadictionary is acceptable. As to why cannot be converted, there is no inheritance relationship.
Mono for Android is very good, but it is too pitfall. It must be interface-oriented, so let's get a document to describe it.
Xamarin simpleadapter binding Error