Code example for FragmentActivity

0
    Fragment fragment = activity.getSupportFragmentManager().findFragmentById(R.id.fragment);
    assertThat(fragment, notNullValue());
    assertThat(fragment.getView(), notNullValue());
  } 
 
  public static class TestActivity extends FragmentActivity { 
    @Override protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_fragment); 
    } 
  } 
}