Object.GetObject Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| GetObject<T>(IntPtr, IntPtr, JniHandleOwnership) |
Creates a managed Java peer of the requested type for the specified JNI object reference. |
| GetObject<T>(IntPtr, JniHandleOwnership) |
Wraps a JNI object reference into a fully typed IJavaObject implementation. |
GetObject<T>(IntPtr, IntPtr, JniHandleOwnership)
Creates a managed Java peer of the requested type for the specified JNI object reference.
public static T? GetObject<T>(IntPtr jnienv, IntPtr handle, Android.Runtime.JniHandleOwnership transfer) where T : class, Android.Runtime.IJavaObject;
static member GetObject : nativeint * nativeint * Android.Runtime.JniHandleOwnership -> 'T (requires 'T : null and 'T :> Android.Runtime.IJavaObject)
Type Parameters
- T
The managed element or peer type used by this operation.
Parameters
- jnienv
-
IntPtr
nativeint
The JNI environment in which the object reference is valid.
- handle
-
IntPtr
nativeint
The JNI object reference to wrap.
- transfer
- JniHandleOwnership
The ownership transfer mode for handle.
Returns
A managed peer for the JNI object reference, or null when the reference is null.
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
GetObject<T>(IntPtr, JniHandleOwnership)
Wraps a JNI object reference into a fully typed IJavaObject implementation.
public static T? GetObject<T>(IntPtr handle, Android.Runtime.JniHandleOwnership transfer) where T : class, Android.Runtime.IJavaObject;
static member GetObject : nativeint * Android.Runtime.JniHandleOwnership -> 'T (requires 'T : null and 'T :> Android.Runtime.IJavaObject)
Type Parameters
- T
The type of the object to return. This type must be a reference type and implement the IJavaObject interface.
Parameters
- transfer
- JniHandleOwnership
The ownership transfer mode for handle.
Returns
A T instance which references that Android
object instance handle.
Exceptions
handle is not of the appropriate type,
as determied by M:Android.Runtime.JNIEnv.IsInstanceOf.
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.