On Dec 1, 2011, at 10:32 AM, Josh Handel wrote:
> Is there any way to wrap third party JARs for reuse?

In a future release we'll be providing better tooling for 3rd party .jar files. 
Unfortunately it couldn't be stabilized in time for the next release. 
(Timeframe _should_ be early next year, but I'm frequently wrong on these 
things...)

Hand binding really needs better documentation (and probably a tutorial). 
That's on my TODO list, but I'm not entirely sure when I'll get there. :-/

Depending on your requirements, you can hand-bind 3rd party .jar files now. (Be 
warned, it'll be ugly...) You do this by using Android.Runtime.JNIEnv and (in 
1.9.x and later) Android.Runtime.RegisterAttribute.

If you're using 1.2, then you can use the JNIEnv type to use JNI to create Java 
classes and invoke methods upon them. See:

        
http://docs.xamarin.com/android/advanced_topics/api_design#Java_Native_Interface_Support

Unfortunately, you can't subclass Java types or implement Java interfaces this 
way.

In 1.9.x and later, you can subclass Java types and implement Java interfaces 
by using the [Register] custom attribute, along with the 
RegisterAttribute.DoNoGenerateAcw property when using [Register] on a type 
(which prevents an ACW from being generated for the specified type). See:

        http://lists.ximian.com/pipermail/monodroid/2011-November/006972.html
        
http://lists.ximian.com/pipermail/monodroid/attachments/20111101/ed9c2ab4/attachment.obj

Again, this is (1) ugly, and (2) brittle, with a lot of implicit, undocumented 
semantics (partially described in the above email), but it _is_ possible, and 
is the core of the entire Mono.Android.dll framework. If you're really 
interested in pursuing this, disassembling Mono.Android.dll would be a good 
start...

 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to