blob: e717cba9e4466bfaa049788a57041b901631a2a5 [file] [log] [blame]
<html devsite="true">
<head>
<title>FragmentOnAttachListener</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>FragmentOnAttachListener</h1>
{% setvar page_path %}androidx/fragment/app/FragmentOnAttachListener.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_java_switcher2.md" %}
<p>
<pre>interface FragmentOnAttachListener</pre>
</p>
<hr>
<p>Listener for receiving a callback immediately following <code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">Fragment#onAttach(Context)</a></code>. This can be used to perform any additional setup / provide any dependencies that the Fragment may need prior to child fragments being attached or the Fragment going through <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreate(android.os.Bundle)">Fragment#onCreate(Bundle)</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">See also</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/androidx/fragment/app/FragmentManager.html#addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)">addFragmentOnAttachListener</a></code></td>
<td width="100%">
<p>androidx.fragment.app.FragmentManager#addFragmentOnAttachListener(FragmentOnAttachListener)</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public methods</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>abstract void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/FragmentOnAttachListener.html#onAttachFragment(androidx.fragment.app.FragmentManager,androidx.fragment.app.Fragment)">onAttachFragment</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;fragmentManager,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;fragment<br>)</code></div>
<p>Called after the fragment has been attached to its host.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public methods</h2>
<div><a name="onAttachFragment(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment)"></a><a name="onAttachFragment-androidx.fragment.app.FragmentManager-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="onAttachFragment(androidx.fragment.app.FragmentManager,androidx.fragment.app.Fragment)">onAttachFragment</h3>
<pre class="api-signature no-pretty-print">public&nbsp;abstract&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/FragmentOnAttachListener.html#onAttachFragment(androidx.fragment.app.FragmentManager,androidx.fragment.app.Fragment)">onAttachFragment</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;fragmentManager,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;fragment<br>)</pre>
<p>Called after the fragment has been attached to its host. This is called immediately after <code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">Fragment#onAttach(Context)</a></code> and before <code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">Fragment#onAttach(Context)</a></code> has been called on any child fragments.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;fragmentManager</code></td>
<td width="100%">
<p>FragmentManager the fragment is now attached to. This will be the same FragmentManager that is returned by <code><a href="/reference/androidx/fragment/app/Fragment.html#getParentFragmentManager()">Fragment#getParentFragmentManager()</a></code>.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;fragment</code></td>
<td width="100%">
<p>Fragment that just received a callback to <code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">Fragment#onAttach(Context)</a></code></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>