title: how to remove fragment after transition to next fragment
body: <p>i use fragment As follows :</p>
  
  <pre><code> img_home.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              ft = fragmentManager.beginTransaction();
              ft.replace(R.id.freamlayout,fragment_home);
              ft.remove(fragment_setting);
              ft.commit();
          }
      });
  
      img_setting.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              ft = fragmentManager.beginTransaction();
              ft.remove(fragment_home);
              ft.replace(R.id.freamlayout,fragment_setting);
              ft.addToBackStack(null);
              ft.commit();
          }
      });
  </code></pre>
  
  <p>but when transition to fragment 2 , stays fragment 1
  how to fix it ??</p>
  
  <p>img1:</p>
  
  <p><img src="https://i.stack.imgur.com/ZtDdb.png" alt="img1"></p>
  
  <p>img2:</p>
  
  <p><img src="https://i.stack.imgur.com/gqyQz.png" alt="img2"></p>