Fragment 추가 및 삭제 예제
04 Mar 2019
|
Android
void addLogViewerFragment() {
logViewerFragment = new LogViewerFragment();
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(R.id.logviewer_layout, logViewerFragment).commit();
}
void removeLogviewerFragment() {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.remove(logViewerFragment).commit();
logViewerFragment = null;
}