title: android fragment replace to second fragment not working
body: <p>My situation is I have a Activity(only FrameLayout),one fragment has a butoon that it's function is changing to second fragmnet,but when i set replace and commit.It's fail.
  I tried this function success brfore,but it's not working now.
  Is anyone can tell me the problem ? It will be grateful.</p>
  
  <p>The first fragment code:</p>
  
  <pre><code>public class StartPage extends Fragment implements View.OnClickListener {
  
      }
      public static StartPage newInstance() {
          return new StartPage();
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View view = inflater.inflate(R.layout.start_page_fragment, container, false);
  
          //findViews();
          imageRegistered = (ImageView) view.findViewById(R.id.imageRegistered);
          imageRegistered.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  FragmentManager fragment=getFragmentManager();
                  FragmentTransaction transaction=fragment.beginTransaction();
                  transaction.replace(R.id.frameStartPage,Register.newInstance(),null);
                  transaction.commit();
                  Toast.makeText(getActivity(),"Test",Toast.LENGTH_SHORT).show();
  
              }
          });
          return view;
      }
  </code></pre>
  
  <p>and it's my frameLayout on the Activity:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/frameStartPage"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.example.huaweb_system.taiwanuniversityhome.MainActivity"&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>MainActivity:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          ActionBar actionBar = getSupportActionBar();
          actionBar.hide();
  
          if (savedInstanceState == null) {
              FragmentManager manager = getSupportFragmentManager();
              FragmentTransaction transaction = manager.beginTransaction();
              transaction.replace(R.id.frameStartPage, StartPage.newInstance());
              transaction.commit();
          }
      }
  }
  </code></pre>
  
  <p>second fragment:</p>
  
  <pre><code>public class Register extends Fragment implements View.OnClickListener {
  
      public static StartPage newInstance() {
          return new StartPage();
      }
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.register_activity, container, false);
  
          findViews();
          return view;
      }
  }
  </code></pre>