Xamarin simpleadapter binding Error

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.