AndroidEventHelper.AddEventHandler<TInterface,TImplementor> 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.
Reuses or creates a listener implementor, then invokes the handler-add callback.
public static void AddEventHandler<TInterface,TImplementor>(ref WeakReference? implementor, Func<TImplementor> creator, Action<TInterface> setListener, Action<TImplementor> add) where TInterface : class where TImplementor : Java.Lang.Object, TInterface;
static member AddEventHandler : WeakReference * Func<'Implementor (requires 'Implementor :> Java.Lang.Object and 'Implementor :> 'Interface)> * Action<'Interface (requires 'Interface : null)> * Action<'Implementor (requires 'Implementor :> Java.Lang.Object and 'Implementor :> 'Interface)> -> unit (requires 'Interface : null and 'Implementor :> Java.Lang.Object and 'Implementor :> 'Interface)
Type Parameters
- TInterface
The reference-type listener contract implemented by TImplementor.
- TImplementor
The Java.Lang.Object-derived listener implementation.
Parameters
- implementor
- WeakReference
The weak reference to reuse or replace with a newly created implementor.
- creator
- Func<TImplementor>
Creates an implementor when the weak reference has no target.
- setListener
- Action<TInterface>
Registers a newly created implementor as the listener.
- add
- Action<TImplementor>
Adds the event handler to the selected implementor.
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.