title: Trying to Open fragment from another fragment in android studio 3.5.3
body: <p>I tried to open my second fragment from my 1st fragment but that giving me error.
  I tried as <a href="https://stackoverflow.com/questions/21028786/how-do-i-open-a-new-fragment-from-another-fragment">This answer</a> and I google it everywhere done the same but not worked for me. I also tired with this <a href="https://developer.android.com/guide/components/fragments.html#Transactions" rel="nofollow noreferrer">android fragment transaction doc</a>  but didn't understand. Please can some one explain and solve this error in simpler way. 
  Here is my code :</p>
  
  <pre><code>            FragmentManager fragmentManager=getActivity().getFragmentManager();
              FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction();
              fragmentTransaction.replace(R.id.profile_f, new UProfileFragment()); //My second Fragment | &amp; | home_layout is frame layout
              fragmentTransaction.addToBackStack(null);
              fragmentTransaction.commit();
  </code></pre>
  
  <p>and Here is my android studio screen error Screenshot :</p>
  
  <p><img src="https://i.stack.imgur.com/2vkna.png" alt="Image">
  Screenshot of exact
  <a href="https://i.stack.imgur.com/W4yoH.png" rel="nofollow noreferrer">error</a></p>
  
  <p>Edit : Thank you for your answers this problem was due to androidx library and old android library's code mix up. i was using the old app compact library instead of androidx library. i changed the fragment and function to androidx and it did work. 
  Note for new Android developer: please use one compact library's code (either androidx or android old)</p>