Android Guides | Samples

Android.OS.StrictMode.ThreadPolicy.Builder Class

Creates StrictMode+ThreadPolicy instances.

See Also: StrictMode+ThreadPolicy+Builder

Syntax

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

Remarks

Creates StrictMode+ThreadPolicy 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.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
     .detectAll()
     .penaltyLog()
     .build();
 StrictMode.setThreadPolicy(policy);

[Android Documentation]

Requirements

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

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

See Also: Object

Public Constructors

Create a Builder that detects nothing and has no violations. (but note that StrictMode+ThreadPolicy+Builder.Build will default to enabling StrictMode+ThreadPolicy+Builder.PenaltyLog if no other penalties are specified)
Initialize a Builder from an existing ThreadPolicy.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Build() : StrictMode+ThreadPolicy
Construct the ThreadPolicy instance.
DetectAll() : StrictMode+ThreadPolicy+Builder
Detect everything that's potentially suspect.
DetectCustomSlowCalls() : StrictMode+ThreadPolicy+Builder
Enable detection of slow calls.
DetectDiskReads() : StrictMode+ThreadPolicy+Builder
Enable detection of disk reads.
DetectDiskWrites() : StrictMode+ThreadPolicy+Builder
Enable detection of disk writes.
DetectNetwork() : StrictMode+ThreadPolicy+Builder
Enable detection of network operations.
PenaltyDeath() : StrictMode+ThreadPolicy+Builder
Crash the whole process on violation.
PenaltyDeathOnNetwork() : StrictMode+ThreadPolicy+Builder
Crash the whole process on any network usage.
PenaltyDialog() : StrictMode+ThreadPolicy+Builder
Show an annoying dialog to the developer on detected violations, rate-limited to be only a little annoying.
PenaltyDropBox() : StrictMode+ThreadPolicy+Builder
Enable detected violations log a stacktrace and timing data to the DropBoxManager on policy violation.
PenaltyFlashScreen() : StrictMode+ThreadPolicy+Builder
Flash the screen during a violation.
PenaltyLog() : StrictMode+ThreadPolicy+Builder
Log detected violations to the system log.
PermitAll() : StrictMode+ThreadPolicy+Builder
Disable the detection of everything.
PermitCustomSlowCalls() : StrictMode+ThreadPolicy+Builder
Disable detection of slow calls.
PermitDiskReads() : StrictMode+ThreadPolicy+Builder
Disable detection of disk reads.
PermitDiskWrites() : StrictMode+ThreadPolicy+Builder
Disable detection of disk writes.
PermitNetwork() : StrictMode+ThreadPolicy+Builder
Disable detection of network operations.