public abstract class

FileObserver

extends Object
java.lang.Object
   ↳ android.os.FileObserver

Summary

Constants
int ACCESS File was accessed
int ALL_EVENTS
int ATTRIB Metadata changed
int CLOSE_NOWRITE Unwrittable file closed
int CLOSE_WRITE Writable file was closed
int CREATE Subfile was created
int DELETE Subfile was deleted
int DELETE_SELF Self was deleted
int MODIFY File was modified
int MOVED_FROM File was moved from X
int MOVED_TO File was moved to Y
int MOVE_SELF Self was moved
int OPEN File was opened
Public Constructors
FileObserver(String path)
FileObserver(String path, int mask)
Public Methods
abstract void onEvent(int event, String path)
void startWatching()
void stopWatching()
Protected Methods
void finalize()
Is called before the object's memory is being reclaimed by the VM.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int ACCESS

Since: API Level 1

File was accessed

Constant Value: 1 (0x00000001)

public static final int ALL_EVENTS

Since: API Level 1

Constant Value: 4095 (0x00000fff)

public static final int ATTRIB

Since: API Level 1

Metadata changed

Constant Value: 4 (0x00000004)

public static final int CLOSE_NOWRITE

Since: API Level 1

Unwrittable file closed

Constant Value: 16 (0x00000010)

public static final int CLOSE_WRITE

Since: API Level 1

Writable file was closed

Constant Value: 8 (0x00000008)

public static final int CREATE

Since: API Level 1

Subfile was created

Constant Value: 256 (0x00000100)

public static final int DELETE

Since: API Level 1

Subfile was deleted

Constant Value: 512 (0x00000200)

public static final int DELETE_SELF

Since: API Level 1

Self was deleted

Constant Value: 1024 (0x00000400)

public static final int MODIFY

Since: API Level 1

File was modified

Constant Value: 2 (0x00000002)

public static final int MOVED_FROM

Since: API Level 1

File was moved from X

Constant Value: 64 (0x00000040)

public static final int MOVED_TO

Since: API Level 1

File was moved to Y

Constant Value: 128 (0x00000080)

public static final int MOVE_SELF

Since: API Level 1

Self was moved

Constant Value: 2048 (0x00000800)

public static final int OPEN

Since: API Level 1

File was opened

Constant Value: 32 (0x00000020)

Public Constructors

public FileObserver (String path)

Since: API Level 1

public FileObserver (String path, int mask)

Since: API Level 1

Public Methods

public abstract void onEvent (int event, String path)

Since: API Level 1

public void startWatching ()

Since: API Level 1

public void stopWatching ()

Since: API Level 1

Protected Methods

protected void finalize ()

Since: API Level 1

Is called before the object's memory is being reclaimed by the VM. This can only happen once the VM has detected, during a run of the garbage collector, that the object is no longer reachable by any thread of the running application.

The method can be used to free system resources or perform other cleanup before the object is garbage collected. The default implementation of the method is empty, which is also expected by the VM, but subclasses can override finalize() as required. Uncaught exceptions which are thrown during the execution of this method cause it to terminate immediately but are otherwise ignored.

Note that the VM does guarantee that finalize() is called at most once for any object, but it doesn't guarantee when (if at all) finalize() will be called. For example, object B's finalize() can delay the execution of object A's finalize() method and therefore it can delay the reclamation of A's memory. To be safe, use a ReferenceQueue, because it provides more control over the way the VM deals with references during garbage collection.