title: setText method does not work inside the onViewCreated method
body: <p><strong>DetailsFragment -&gt; onCreateView</strong></p>
  <pre><code>@Override
  public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      if (fragmentBinding == null)
          fragmentBinding = FragmentDetails.inflate(inflater, container, false);
      return fragmentBinding.getRoot();
  }
  </code></pre>
  <p><strong>DetailsFragment -&gt; onViewCreated</strong></p>
  <pre><code>@Override
  public void onViewCreated(@NonNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);
  
      int x = new Random().nextInt(10000);
      Log.w(&quot;Result&quot;, &quot;... &quot; + x);
      fragmentBinding.titleEditText.setText(String.valueOf(x));
  
  }
  </code></pre>
  <p>When open <code>DetailsFragment</code> for the first time, <code>titleEditText</code> will take the generated number from the <code>x</code> variable (Let's suppose it <code>528</code>)</p>
  <p>Inside <code>DetailsFragment</code> there is a button that will navigate me to the <code>BFragment</code> fragment.</p>
  <p>When navigating to the <code>BFragment</code> fragment and doing some tasks, I will press the back button for back to <code>DetailsFragment</code></p>
  <p><strong>What do I expect the result?</strong></p>
  <p>When back from <code>BFragment</code> to <code>DetailsFragment</code> the  <code>x</code> variable will take a new random number (Let's suppose it <code>362</code>) and put it inside <code>titleEditText</code>.</p>
  <p><strong>What is the current result?</strong></p>
  <p>The text inside <code>titleEditText</code> still have <code>528</code> value but it must take <code>362</code> value</p>
  <p><strong>Notes</strong></p>
  <ul>
  <li>It's working well if I put the code inside the <code>onResume</code> method.</li>
  <li>I'm using the navigation component library with backstack.</li>
  </ul>
  <hr />
  <p><strong>Improved the question (Added more details)</strong></p>
  <p>I built a simple app with 2 fragments to show you my problem</p>
  <p>Watch the result via the <a href="https://streamable.com/npzkjl" rel="nofollow noreferrer">video</a> on streamable.com, <a href="https://stackoverflow.com/users/6287910/cheticamp">Mr
  Cheticamp</a>, If the video doesn't work tell me and I'll upload it to Youtube.</p>
  <p><strong>Here is the Logcat when running the app for the first time</strong></p>
  <p><a href="https://i.stack.imgur.com/onKyi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/onKyi.png" alt="enter image description here" /></a></p>
  <p><strong>And this is the Logcat when back from SecondFragment to FirstFragment</strong></p>
  <p><a href="https://i.stack.imgur.com/3fFLo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3fFLo.png" alt="enter image description here" /></a></p>
  <p><strong>Here is the code for FirstFragment</strong></p>
  <pre><code>public class FirstFragment extends Fragment {
  
      private FragmentFirstBinding fragmentFirstBinding;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Log.w(&quot;FirstFragment&quot;, &quot;onCreate&quot;);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          Log.w(&quot;FirstFragment&quot;, &quot;onCreateView&quot;);
          if (fragmentFirstBinding == null)
              fragmentFirstBinding = FragmentFirstBinding.inflate(inflater, container, false);
          return fragmentFirstBinding.getRoot();
      }
  
      @Override
      public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
          Log.w(&quot;FirstFragment&quot;, &quot;onViewCreated&quot;);
  
          fragmentFirstBinding.btnFirst.setOnClickListener(view1 -&gt; Navigation.findNavController(view1).navigate(FirstFragmentDirections.actionFirstFragmentToSecondFragment()));
  
          int x = new Random().nextInt(10000);
          fragmentFirstBinding.edittext.setText(String.valueOf(x));
          Log.w(&quot;FirstFragment - X Value&quot;, &quot;... &quot; + x);
      }
  
  }
  </code></pre>
  <p><strong>And here is the code for SecondFragment</strong></p>
  <pre><code>public class SecondFragment extends Fragment {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          return inflater.inflate(R.layout.fragment_second, container, false);
      }
  
      @Override
      public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
          view.findViewById(R.id.btnSecond).setOnClickListener(view1 -&gt; Navigation.findNavController(view1).popBackStack());
      }
  
  }
  </code></pre>