FragmentStrictMode

object FragmentStrictMode


FragmentStrictMode is a tool which detects things you might be doing by accident and brings them to your attention so you can fix them. Basically, it's a version of android.os.StrictMode specifically for fragment-related issues.

You can decide what should happen when a violation is detected. For example, using Policy.Builder.penaltyLog you can watch the output of adb logcat while you use your application to see the violations as they happen.

Summary

Nested types

FragmentStrictMode.OnViolationListener

When Policy.Builder.penaltyListener is enabled, the listener is called when a violation occurs.

FragmentStrictMode.Policy

FragmentStrictMode policy applied to a certain FragmentManager (or globally).

FragmentStrictMode.Policy.Builder

Creates Policy instances.

Public fields

final @NonNull FragmentStrictMode.Policy

The current policy for what actions should be detected, as well as the penalty if such actions occur.

Public methods

final @VisibleForTesting void

Public fields

defaultPolicy

@NonNull
public final @NonNull FragmentStrictMode.Policy defaultPolicy

The current policy for what actions should be detected, as well as the penalty if such actions occur.

Public methods

onPolicyViolation

@VisibleForTesting
@NonNull
public final @VisibleForTesting void onPolicyViolation(@NonNull Violation violation)