[mono-android] ClassNotFoundException with ItemClick event
Faze Faze
faze1224 at gmail.com
Fri Mar 25 05:27:50 EDT 2011
Hello guys,
I'm new to monodroid (and new to android dev) and I'm facing a problem when
binding the ItemClick event.
I don't think it's a bug (I've code found on the net that bind it without
any error), instead I think I'm making things wrong but after looking at
dozens of sample I don't find where my error is...
I've an activity that have to display a list of item:
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
//Set the Activity's view to our list layout
SetContentView(Resource.Layout.DeviceList);
var server = new MockServer();
var listView = this.FindViewById<ListView>(Resource.Id.listView);
listView.Adapter = new DeviceAdapter(this,
Resource.Layout.OnOffDevice, server.GetDevices());
//Wire up the click event
//listView.ItemClick += new EventHandler<ItemEventArgs>(showToast);
}
void showToast(object sender, ItemEventArgs e)
{
Toast.MakeText(this, "Hello", ToastLength.Short).Show();
}
If I uncomment the "listView.ItemClick" line, I've this error when the
handler is added:
- Instance {Java.Lang.ClassNotFoundException: Exception of type
'Java.Lang.ClassNotFoundException' was thrown.
at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr
jmethod, Android.Runtime.JValue[] parms) [0x00024] in
/home/jpobst/Desktop/mondroid/Mono.Android/src/Runtime/JNIEnv.cs:328
at Android.Runtime.JNIEnv.FindClass (System.String classname) [0x00032] in
/home/jpobst/Desktop/mondroid/Mono.Android/src/Runtime/JNIEnv.cs:155 }
Java.Lang.ClassNotFoundException
In details:
Message "android.widget.ItemClickImplementor in loader
dalvik.system.PathClassLoader[/data/app/net.colsup.homidroid-1.apk]"
string
StackTrace " at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr
jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00024] in
/home/jpobst/Desktop/mondroid/Mono.Android/src/Runtime/JNIEnv.cs:328 \n at
Android.Runtime.JNIEnv.FindClass (System.String classname) [0x00032] in
/home/jpobst/Desktop/mondroid/Mono.Android/src/Runtime/JNIEnv.cs:155 "
string
Do you have any idea on where the problem is ?
Thank you for your help!
Fabrice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110325/b3a23959/attachment-0001.html
More information about the Monodroid
mailing list