Android Guides | Samples

Android.OS.StrictMode.VmPolicy.Builder Class

Creates StrictMode+VmPolicy instances.

See Also: StrictMode+VmPolicy+Builder


[Android.Runtime.Register("android/os/StrictMode$VmPolicy$Builder", DoNotGenerateAcw=true)]
public sealed class StrictMode.VmPolicy.Builder : Object


Creates StrictMode+VmPolicy instances. Methods whose names start with detect specify what problems we should look for. Methods whose names start with penalty specify what we should do when we detect a problem.

You can call as many detect and penalty methods as you like. Currently order is insignificant: all penalties apply to all detected problems.

For example, detect everything and log anything that's found:

java Example

 StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder()

[Android Documentation]


Namespace: Android.OS
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions:
Since: Added in API level 9

The members of Android.OS.StrictMode.VmPolicy.Builder are listed below.

See Also: Object

Public Constructors

Protected Properties

ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Build() : StrictMode+VmPolicy
Construct the VmPolicy instance.
DetectActivityLeaks() : StrictMode+VmPolicy+Builder
Detect leaks of Activity subclasses.
DetectAll() : StrictMode+VmPolicy+Builder
Detect everything that's potentially suspect.
DetectFileUriExposure() : StrictMode+VmPolicy+Builder
Detect when a file://Uri is exposed beyond this app.
DetectLeakedClosableObjects() : StrictMode+VmPolicy+Builder
Detect when an ICloseable or other object with a explict termination method is finalized without having been closed.
DetectLeakedRegistrationObjects() : StrictMode+VmPolicy+Builder
Detect when a BroadcastReceiver or IServiceConnection is leaked during Context teardown.
DetectLeakedSqlLiteObjects() : StrictMode+VmPolicy+Builder
Detect when an SQLiteCursor or other SQLite object is finalized without having been closed.
PenaltyDeath() : StrictMode+VmPolicy+Builder
Crashes the whole process on violation.
PenaltyDropBox() : StrictMode+VmPolicy+Builder
Enable detected violations log a stacktrace and timing data to the DropBoxManager on policy violation.
PenaltyLog() : StrictMode+VmPolicy+Builder
Log detected violations to the system log.
SetClassInstanceLimit(Class, Int32) : StrictMode+VmPolicy+Builder
Set an upper bound on how many instances of a class can be in memory at once.