It seems SimpleAdapter is broken (found this in 4.2 alpha), 4.2.1 release
also have this issue:
var settings_data = new List<IDictionary<string, object>>();
sa = Resources.ObtainTypedArray(Resource.Array.settings_text);
sa_icons =
Resources.ObtainTypedArray(Resource.Array.settings_icons);
for (int i = 0; i < sa.Length(); i++)
{
var item = new Dictionary<string, object>();
item["text"] = sa.GetString(i);
item["icon"] = sa_icons.GetResourceId(i, 0);
settings_data.Add(item);
}
this.ListAdapter = new SimpleAdapter(this, settings_data,
Resource.Layout.list_item_icon_text, new String[] { "text",
"icon" },
new int[] { Resource.Id.text, Resource.Id.icon });
gives
E/AndroidRuntime( 3930): FATAL EXCEPTION: main
E/AndroidRuntime( 3930): java.lang.ClassCastException:
mono.android.runtime.JavaObject cannot be cast to java.util.Map
E/AndroidRuntime( 3930): at
android.widget.SimpleAdapter.bindView(SimpleAdapter.java:147)
E/AndroidRuntime( 3930): at
android.widget.SimpleAdapter.createViewFromResource(SimpleAdapter.java:126)
The code worked fine in 4.1
I've tried to switch to JavaList - but SimpleAdapter does not accept it (it
needs IList<IDictionary>)
The only workaround I've found now is ArrayAdapter usage (but it of course
can't create list with icons).
Can you elaborate on this?
Igor
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid