java.interop
java.interop copied to clipboard
Java.Interop provides open-source bindings of Java's Java Native Interface (JNI) for use with .NET managed languages such as C#
`generator` emits `System.String` overloads for Java members which accept or return `java.lang.ICharSequence`. For example, consider [`TextView.setText()`](https://developer.android.com/reference/android/widget/TextView#setText(java.lang.CharSequence)), which is combined with `getText()` into a `TextFormatted` property: ```csharp namespace Android.Widget { public...
It's quite common to need to modify multiple attributes on a given element via Metadata. Consider: Updating `ContentProvider.setReadPermission()`: https://github.com/xamarin/xamarin-android/blob/d260d035a840dd314ddc7ef194489933a9929794/src/Mono.Android/metadata#L72-L75 Update `ActivityInstrumentationTestCase.getActivity()`: https://github.com/xamarin/xamarin-android/blob/d260d035a840dd314ddc7ef194489933a9929794/src/Mono.Android/metadata#L223-L224 Update `RemoteController.OnClientUpdateListener.onClientPlaybackStateUpdate()`: https://github.com/xamarin/xamarin-android/blob/d260d035a840dd314ddc7ef194489933a9929794/src/Mono.Android/metadata#L835-L837 See also #981, in which...
[`tools/logcat-parse`](https://github.com/xamarin/Java.Interop/tree/main/tools/logcat-parse) currently uses the [Mono.CSharp](https://www.nuget.org/packages/Mono.CSharp/) and [Mono.Terminal](https://www.nuget.org/packages/Mono.Terminal/) NuGet packages. The `Mono.CSharp` NuGet package only targets net45. It is not compatible with .NET 6, and even though `logcat-parse` is multi-targeted to...
Context: 9057654549ac533520116ae68d0ba3d602ba3b2a Context: https://github.com/xamarin/java.interop/commits/main/src/Java.Interop.Dynamic Context: https://www.youtube.com/watch?v=bgK_6anwMcw Context: https://github.com/Redth/Xamarin.Binding.Helpers Context: https://github.com/xamarin/xamarin-android/pull/5926 Context: https://github.com/xamarin/xamarin-android/issues/5352 Context: https://gist.github.com/Redth/958d1a6efd047e32c7709b3b5c3b63bb Context: https://docs.flutter.dev/development/platform-integration/platform-channels [Binding a Java library](https://docs.microsoft.com/en-us/xamarin/android/platform/binding-java-library/) can be extremely difficult. While we have (on-again, off-again) tried...
https://twitter.com/sh4na/status/600662831017676800 > If a user of your API complains of breakage and you reply “oh, you shouldn’t be doing that”, it’s a sign that your API is badly designed. What's...
Context: http://github.com/xamarin/monodroid/commit/c0ad930298013425e4797f89b0c9243c22827152 Context: https://github.com/xamarin/java.interop/issues/858 From xamarin/monodroid@c0ad930298013425e4797f89b0c9243c22827152 (2011-Nov-28): > Remember xamarin/monodroid@62a4766, and how the issue was an intermixing of static and > instance data on the interface Invokers? > > One...
Context: https://github.com/dotnet/runtime/issues/65853 `generator` emits "JNI Marshal Methods", which are methods to be called *by* Java/JNI, which marshals parameters and return types in order to "forward" to virtual method overrides: https://github.com/xamarin/java.interop/blob/1987829f96d58c3298fa1e3d86ef3cd0e12e6c31/tests/generator-Tests/expected.xaji/NormalMethods/Xamarin.Test.A.cs#L52-L56...
Context: https://github.com/xamarin/xamarin-android/pull/6750#discussion_r813115840 Workaround: https://github.com/xamarin/java.interop/wiki/Duplicate-Event-Handlers Previously we did some work to support multiple listener methods with the same name, which involved ensuring duplicate `EventArgs` types were not generated. This seems good,...
Currently, `Java.Interop.JniPeerMembers` member lookups are backed via dictionary lookup with `string` as the key-type, e.g. https://github.com/xamarin/java.interop/blob/7dc270dbb83948b278bee38fc83bf9ae5cd42a7e/src/Java.Interop/Java.Interop/JniPeerMembers.JniStaticMethods.cs#L18 https://github.com/xamarin/java.interop/blob/7dc270dbb83948b278bee38fc83bf9ae5cd42a7e/src/Java.Interop/Java.Interop/JniPeerMembers.JniStaticMethods.cs#L25-L36 This works, and provides a reasonably "user-friendly" interface, but has hidden performance implications:...