I have a class like this:
public class YouTubeThumbnailImpl : Fuse.Android.Controls.Control<YouTubeThumbnail>
Which needs to implement
internal sealed override global::Android.android.view.View CreateInternal()
How ever when I do this in Foreign Code, I get a
Java.Object back. I think I need a JNI wrapper or something to be able to do:
And the Fuse JNI-stuff is all black magic to me.
Hi, thanks for waiting,
JNIWrappers so feel free just to cast them. JNIWrapper is the root class (superclass of Android.Java.Object) of the old Java bindings, we use it in ForeignCode to keep compatibility and avoid rewriting, however the undocumented parts of these apis are subject to change at our evil whim
The best person to answer the question about how to make Fuse views with Android bindings is currently on leave, there are lots of changes happening in that area behind the scenes but I’ll see if theres any info I can find on this.
Can I cast a Java.Object that is a subclass android.view.View to a global::Android.android.view.View (old binding)?
I’m guessing you have to keep the old binding systems for the native controls, or do you have another plan for those?
Hey, To answer your first question, no the case won’t work. Making that valid would take a fair bit of work to make stable and we are in the process of moving away from the old bindings.
Sorry you are in this limbo period but I do have a hack that should work for now. This should also be considered deprecated behaviour though.
Java.Object x = GetSomeViewFromForeignCode();
View v = new View(((JWrapper)x)._GetJavaObject(), typeof(View), false, false);
I hope this helps in the interim