blob: c10b3c86c006ac35ab5c3b8261810cdf7677e229 [file] [log] [blame]
<html devsite="true">
<head>
<title>FragmentStrictMode</title>
{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div id="metadata-info-block"></div>
<h1>FragmentStrictMode</h1>
<p>
<pre>object <a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.html">FragmentStrictMode</a></pre>
</p>
<hr>
<p>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 <code><a href="https://developer.android.com/reference/android/os/StrictMode.html">android.os.StrictMode</a></code> specifically for fragment-related issues.</p>
<p>You can decide what should happen when a violation is detected. For example, using <code><a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder.html#penaltyLog()">Policy.Builder.penaltyLog</a></code> you can watch the output of <code>adb logcat</code> while you use your application to see the violations as they happen.</p>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Nested types</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code>fun interface <a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.OnViolationListener.html">FragmentStrictMode.OnViolationListener</a></code></div>
<p>When <code><a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder.html#penaltyListener(androidx.fragment.app.strictmode.FragmentStrictMode.OnViolationListener)">Policy.Builder.penaltyListener</a></code> is enabled, the listener is called when a violation occurs.</p>
</td>
</tr>
<tr>
<td>
<div><code>class <a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.html">FragmentStrictMode.Policy</a></code></div>
<p><code><a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.html">FragmentStrictMode</a></code> policy applied to a certain <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code> (or globally).</p>
</td>
</tr>
<tr>
<td>
<div><code>class <a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder.html">FragmentStrictMode.Policy.Builder</a></code></div>
<p>Creates <code><a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.html">Policy</a></code> instances.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public properties</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.html">FragmentStrictMode.Policy</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.html#defaultPolicy()">defaultPolicy</a></code></div>
<p>The current policy for what actions should be detected, as well as the penalty if such actions occur.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="list">
<h2>Public properties</h2>
<div class="api-item"><a name="getDefaultPolicy()"></a><a name="setDefaultPolicy()"></a><a name="getDefaultPolicy--"></a><a name="setDefaultPolicy--"></a>
<h3 class="api-name" id="defaultPolicy()">defaultPolicy</h3>
<pre class="api-signature no-pretty-print">var&nbsp;<a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.html#defaultPolicy()">defaultPolicy</a>:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.html">FragmentStrictMode.Policy</a></pre>
<p>The current policy for what actions should be detected, as well as the penalty if such actions occur.</p>
</div>
</div>
</body>
</html>