Condividi tramite


FileObserver.OnEvent(FileObserverEvents, String) Method

Definition

The event handler, which must be implemented by subclasses.

[Android.Runtime.Register("onEvent", "(ILjava/lang/String;)V", "GetOnEvent_ILjava_lang_String_Handler")]
public abstract void OnEvent (Android.OS.FileObserverEvents e, string? path);
[<Android.Runtime.Register("onEvent", "(ILjava/lang/String;)V", "GetOnEvent_ILjava_lang_String_Handler")>]
abstract member OnEvent : Android.OS.FileObserverEvents * string -> unit

Parameters

e
FileObserverEvents

The type of event which happened

path
String

The path, relative to the main monitored file or directory, of the file or directory which triggered the event. This value can be null for certain events, such as #MOVE_SELF.

Attributes

Remarks

The event handler, which must be implemented by subclasses.

<p class="note">This method is invoked on a special FileObserver thread. It runs independently of any threads, so take care to use appropriate synchronization! Consider using Handler#post(Runnable) to shift event handling work to the main thread to avoid concurrency problems.</p>

Event handlers must not throw exceptions.

Java documentation for android.os.FileObserver.onEvent(int, java.lang.String).

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