Extensions.JavaCast<TResult>(IJavaObject) 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.
Performs an Android runtime-checked type conversion.
public static TResult? JavaCast<TResult> (this Android.Runtime.IJavaObject? instance) where TResult : class, Android.Runtime.IJavaObject;
static member JavaCast : Android.Runtime.IJavaObject -> 'Result (requires 'Result : null and 'Result :> Android.Runtime.IJavaObject)
Type Parameters
- TResult
The type to convert instance
to.
TResult
must implement the
IJavaObject interface.
Parameters
- instance
- IJavaObject
An IJavaObject instance to convert
to a TResult
instance.
Returns
A TResult
representation for
instance
.
Exceptions
The JNI class for TResult
cannot be found.
-or-
The proxy class for TResult
is
abstract
, and the non-abstract
Proxy can't be found.
The Anrdroid object instance
cannot be converted to the Android type corresponding to
instance
.HandleTResult
.
An unknown error occurred.
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.