0
참고 매우 개의이 "중복"을 확인했지만 그 중 아무 것도 청구서에 맞지 않으므로 중복으로 표시하지 마십시오. . 그러나findFragmentByID()는 컨테이너 ID가 생성 된 직후 null을 반환합니다.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
Log.d("", "Found fragment: " + getSupportFragmentManager().findFragmentById(R.id.container));
}
이 (추가 유일한 문이 Log
라인이다)처럼이 생성 된 후
:
찾을 조각 비슷한 질문에 대한 답이 있으면 효과가 있습니다. 무슨 일이야?