-
Notifications
You must be signed in to change notification settings - Fork 53
Glossary
.NET code that runs in the CLR (C#, VB.NET, etc) is often referred to as "managed" code. Thus most of our terminology uses Java
or Android
to refer to Java code, and Managed
to refer to C# code.
In computing, the Java Native Interface (JNI) is a programming framework that enables Java code running in a Java Virtual Machine (JVM) to call and be called by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages such as C, C++ and assembly.
Android callable wrappers are a JNI bridge that are used whenver the Android runtime needs to invoke managed code.
Managed callable wrappers are a JNI bridge that are used whenever managed code needs to invoke Android code and provide support for overriding virtual methods and implementing Java interfaces.
When using a Build Action
such as EmbeddedJar
or EmbeddedReferenceJar
, it will embed the respective library into the .apk so it will be available at runtime.
Otherwise it is expected that either the Device or the application will provide the .jar at runtime. (I.E. It is already loaded on device or will be provided via a download/etc)
When using a Build Action
such as ReferenceJar
or EmbeddedReferenceJar
, it will not generate Manage Callable Wrappers(ACW) and will not be exposed to the client.
C# includes some language features that are very familiar to .NET developers, but do not exist in Java. Also, C# uses different naming conventions than Java.
When designing the bindings process, we made the decision to try to make the resulting bindings "feel" more like a .NET API. This mean some things get renamed or changed to different language constructs. While this has advantages when regularly consuming an API, it has disadvantages when trying to "copy" Java examples verbatim.
Here are some transformations that are performed:
- Names of many things get translated to .NET style guidelines. Some examples:
- Namespaces:
com.example
->Com.Example
- Methods:
doSomething ()
->DoSomething ()
- Namespaces:
- Java uses getters and setters like
getVisible
andsetVisible (bool)
. These get translated to .NET properties:Visible
. - Fields that are not constants get translated to .NET properties.
- The Java listener pattern
addOnPropertyChangedListener
is translated to .NET events:public event EventHandler<PropertyChangedEventArgs> PropertyChanged
. - Java static nested classes become instance nested classes.
- Java inner classes become nested classes with an instance constructor.