mail-archives/monodroid/2011-December/007503.html

152 строки
6.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [mono-android] MonoDroid4 : Previously working ArrayAdapter&lt;int&gt; not working any more
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20MonoDroid4%20%3A%20Previously%20working%20ArrayAdapter%3Cint%3E%0A%20not%20working%20any%20more&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="007509.html">
<LINK REL="Next" HREF="007507.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[mono-android] MonoDroid4 : Previously working ArrayAdapter&lt;int&gt; not working any more</H1>
<B>klimaye</B>
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20MonoDroid4%20%3A%20Previously%20working%20ArrayAdapter%3Cint%3E%0A%20not%20working%20any%20more&In-Reply-To="
TITLE="[mono-android] MonoDroid4 : Previously working ArrayAdapter&lt;int&gt; not working any more">klimaye at gmail.com
</A><BR>
<I>Mon Dec 5 15:01:07 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="007509.html">[mono-android] 4.0 crashing previously working source.
</A></li>
<LI>Next message: <A HREF="007507.html">[mono-android] MonoDroid4 : Previously working ArrayAdapter&lt;int&gt; not working any more
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7503">[ date ]</a>
<a href="thread.html#7503">[ thread ]</a>
<a href="subject.html#7503">[ subject ]</a>
<a href="author.html#7503">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE><A HREF="http://mono-for-android.1047100.n5.nabble.com/file/n5049949/MonoAndroid4Test.zip">http://mono-for-android.1047100.n5.nabble.com/file/n5049949/MonoAndroid4Test.zip</A>
MonoAndroid4Test.zip
I have an ArrayAdapter&lt;int&gt; as a datasource to a spinner. The code blows up
when the adapter tries to get an item. It seems like it works if T is a
string but not if T is an int. This was working previously for sure.
Sample project attached.
Here is the log
I/test (19493): string : val = 1,SelectedItemPosition = 0,v.Adapter is
null : False
I/test (19493): string: Adapter.Count = 12
I/test (19493): string: Adapter.GetItem(0)
I/test (19493): after string selection
I/test (19493): val = 1,SelectedItemPosition = 0,v.Adapter is null :
False
I/test (19493): Adapter.Count = 12
I/mono (19493): Stacktrace:
I/mono (19493):
I/mono (19493): at Android.Runtime.JNIEnv.GetObjectClass (intptr)
&lt;0x0003f&gt;
I/mono (19493): at Android.Runtime.TypeManager.CreateInstance
(intptr,Android.Runtime.JniHandleOwnership,System.Type) &lt;0x0006f&gt;
I/mono (19493): at Java.Lang.Object.GetObject
(intptr,Android.Runtime.JniHandleOwnership,System.Type) &lt;0x00267&gt;
I/mono (19493): at Java.Lang.Object._GetObject&lt;T&gt;
(intptr,Android.Runtime.JniHandleOwnership) &lt;0x0004f&gt;
I/mono (19493): at Java.Lang.Object.GetObject&lt;T&gt;
(intptr,Android.Runtime.JniHandleOwnership) &lt;0x0002b&gt;
I/mono (19493): at Android.Widget.ArrayAdapter.GetItem (int) &lt;0x0022b&gt;
I/mono (19493): at MonoAndroid4Test.Activity1.OnCreate
(Android.OS.Bundle) &lt;0x00633&gt;
I/mono (19493): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_
(intptr,intptr,intptr) &lt;0x0005f&gt;
I/mono (19493): at (wrapper dynamic-method)
object.96b38cf9-49a9-479b-856f-42158dabe849 (intptr,intptr,intptr) &lt;0x00033&gt;
I/mono (19493): at (wrapper native-to-managed)
object.96b38cf9-49a9-479b-856f-42158dabe849 (intptr,intptr,intptr)
&lt;0xffffffff&gt;
E/mono (19493):
E/mono (19493): Unhandled Exception: System.NullReferenceException:
Object reference not set to an instance of an object
E/mono (19493): at Android.Runtime.JNIEnv.GetObjectClass (IntPtr
jobject) [0x00000] in &lt;filename unknown&gt;:0
E/mono (19493): at Android.Runtime.TypeManager.CreateInstance (IntPtr
handle, JniHandleOwnership transfer, System.Type targetType) [0x00000] in
&lt;filename unknown&gt;:0
E/mono (19493): at Java.Lang.Object.GetObject (IntPtr handle,
JniHandleOwnership transfer, System.Type type) [0x00000] in &lt;filename
unknown&gt;:0
E/mono (19493): at Java.Lang.Object._GetObject[Object] (IntPtr handle,
JniHandleOwnership transfer) [0x00000] in &lt;filename unknown&gt;:0
E/mono (19493): at Java.Lang.Object.GetObject[Object] (IntPtr handle,
JniHandleOwnership transfer) [0x00000] in &lt;filename unknown&gt;:0
E/mono (19493): at Android.Widget.ArrayAdapter.GetItem (Int32 position)
[0x00000] in &lt;filename unknown&gt;:0
E/mono (19493): at MonoAndroid4Test.Activity1.OnCreate
(Android.OS.Bundle bundle) [0x00000] in &lt;filename unknown&gt;:0
E/mono (19493): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_
(IntPtr jnienv, IntPtr native__this, IntPtr na
--
View this message in context: <A HREF="http://mono-for-android.1047100.n5.nabble.com/MonoDroid4-Previously-working-ArrayAdapter-int-not-working-any-more-tp5049949p5049949.html">http://mono-for-android.1047100.n5.nabble.com/MonoDroid4-Previously-working-ArrayAdapter-int-not-working-any-more-tp5049949p5049949.html</A>
Sent from the Mono for Android mailing list archive at Nabble.com.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="007509.html">[mono-android] 4.0 crashing previously working source.
</A></li>
<LI>Next message: <A HREF="007507.html">[mono-android] MonoDroid4 : Previously working ArrayAdapter&lt;int&gt; not working any more
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7503">[ date ]</a>
<a href="thread.html#7503">[ thread ]</a>
<a href="subject.html#7503">[ subject ]</a>
<a href="author.html#7503">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/monodroid">More information about the Monodroid
mailing list</a><br>
</body></html>