Re: [mono-android] JNI Help Please

2012-02-13 Thread Jonathan Pryor
Sorry for the delay... On Feb 6, 2012, at 5:45 PM, digitalml wrote: > So using the above code that you posted is working for me, but the > constructor to my .java object is being called multiple times and is > producing some strange behavior. How many instances of my java object are > created w

Re: [mono-android] JNI Help Please

2012-02-13 Thread digitalml
Jon, Any ideas on this please? I'm using the exact code you provided in the previous posts. -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/JNI-Help-Please-tp5144171p5480147.html Sent from the Mono for Android mailing list archive at Nabble.com. ___

Re: [mono-android] JNI Help Please

2012-02-06 Thread digitalml
Hi Jon, So using the above code that you posted is working for me, but the constructor to my .java object is being called multiple times and is producing some strange behavior. How many instances of my java object are created with the above code? Is it calling my object constructor more than once

Re: [mono-android] JNI Help Please

2012-02-03 Thread Jonathan Pryor
On Feb 3, 2012, at 2:29 PM, digitalml wrote: > Now how do I convert that JavaArray cardData to something useful? Depends on what "something useful" is. JavaArray implements IList; isn't IList useful? ;-) If you'd prefer a byte[], you could use LINQ's .ToArray() extension method. Alternatively,

Re: [mono-android] JNI Help Please

2012-02-03 Thread digitalml
Woo Hoo, thanks Jon! My problem was that I was calling YourJniHelper instead of instantiating MyJniHelper. The callback is now received. Now how do I convert that JavaArray cardData to something useful? Thanks -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/JNI

Re: [mono-android] JNI Help Please

2012-02-03 Thread Jonathan Pryor
It would be handy to have the .jar file to test against (or something with the same API). That said.. On Feb 3, 2012, at 1:51 PM, digitalml wrote: > I used your code to call the jni_helper and initialize the reader; however, > the manged wrapper for the onReceiveMsgCardData() is never called. Ar

Re: [mono-android] JNI Help Please

2012-02-03 Thread digitalml
Jon, First, thanks for all your help on this, its gotten me pretty far. I used your code to call the jni_helper and initialize the reader; however, the manged wrapper for the onReceiveMsgCardData() is never called. You were right in assuming that the 'uniMagReader' instance calls the onReceiveM

Re: [mono-android] JNI Help Please

2012-01-16 Thread Jonathan Pryor
On Jan 16, 2012, at 8:06 PM, digitalml wrote: > I still have the issue of the callback though. What happens in the .java code > is that when a hardware event occurs it fires the onReceiveMsgCardData() > event. My question from before remains the same: what code is calling onReceiveMsgCardData()

Re: [mono-android] JNI Help Please

2012-01-16 Thread digitalml
Hi Jon, Thanks for your help. Based on the exception info I was able to fix the issues with the .java code and can now call the methods via JNI. I still have the issue of the callback though. What happens in the .java code is that when a hardware event occurs it fires the onReceiveMsgCardData() ev

Re: [mono-android] JNI Help Please

2012-01-16 Thread Jonathan Pryor
On Jan 16, 2012, at 3:16 PM, digitalml wrote: > This fails on the JNIEnv.CallVoidMethod() call. Is there a way to see what > the error actually is? An exception is thrown. Exception.ToString() will also print out the Java-side message and stack trace. Throw the code within a try/catch(Exception

Re: [mono-android] JNI Help Please

2012-01-16 Thread digitalml
Hi Jon, An update to my previous post... I looked into that sanity check code and updated my code based on it's example. IntPtr helperClass = JNIEnv.FindClass("MagHelper/jni_helper"); IntPtr ctor = JNIEnv.GetMethodID(helperClass, "", "()V"); IntPtr methodId = JNIEnv.GetMethodID(helperClass, "Ini

Re: [mono-android] JNI Help Please

2012-01-16 Thread digitalml
Hi Jon, First, thank you for taking the time to create such it a detailed response, it's greatly appreciated Based on what you said, I've made the ctor public in the .java file. I then changed my JNI code to this, but I get an error on the JNIEnv.GetMethodID call. IntPtr _helperClass = JNIE

Re: [mono-android] JNI Help Please

2012-01-13 Thread Jonathan Pryor
On Jan 13, 2012, at 8:05 PM, digitalml wrote: > All JNI examples I've found either return an activity or use static methods > and mine is not static and not really an activity I want to show on the > screen. The SanityTests sample has a more complete example of JNI use: https://github.c