Cleaner.Register(Object, IRunnable) 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.
Registers an object and a cleaning action to run when the object becomes phantom reachable.
[Android.Runtime.Register("register", "(Ljava/lang/Object;Ljava/lang/Runnable;)Ljava/lang/ref/Cleaner$Cleanable;", "", ApiSince=33)]
public Java.Lang.Ref.Cleaner.ICleanable? Register(Java.Lang.Object? obj, Java.Lang.IRunnable? action);
[<Android.Runtime.Register("register", "(Ljava/lang/Object;Ljava/lang/Runnable;)Ljava/lang/ref/Cleaner$Cleanable;", "", ApiSince=33)>]
member this.Register : Java.Lang.Object * Java.Lang.IRunnable -> Java.Lang.Ref.Cleaner.ICleanable
Parameters
- obj
- Object
the object to monitor
- action
- IRunnable
the cleaning action to run
Returns
a Cleaner.ICleanable instance
- Attributes
Remarks
Registers an object and a cleaning action to run when the object becomes phantom reachable.
The cleaning action is invoked at most once. It must not retain a reference to obj; otherwise, the object will not become phantom reachable and the action will not run automatically.
Java documentation for java.lang.ref.Cleaner.register(java.lang.Object, java.lang.Runnable).
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.