Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Intent extraIntent = getActivity().getIntent(); if(extraIntent!=null){ if (extraIntent.hasExtra("FromMyVideos")) { myVideosFlag = extraIntent.getBooleanExtra( "FromMyVideos", false); } if (chapterName == null) { chapterName = extraIntent.getStringExtra("chapter"); } if (lecture == null) { lecture = (LectureModel) extraIntent .getSerializableExtra("lecture"); } if (enrollment == null) { enrollment = (EnrolledCoursesResponse) extraIntent .getSerializableExtra(Router.EXTRA_COURSE_DATA); } } if (chapterName == null) { if (enrollment != null && lecture != null) { if (lecture.chapter != null) { chapterName = lecture.chapter.chapter; } } } if (playerFragment == null) { playerFragment = new PlayerFragment(); playerFragment.setCallback(this); if (environment.getConfig().isVideoTranscriptEnabled()) { playerFragment.setTranscriptCallback(this); } final CourseUnitVideoFragment.HasComponent hasComponent = (CourseUnitVideoFragment.HasComponent)getActivity(); if (hasComponent != null) { View.OnClickListener next = null; View.OnClickListener prev = null; if (hasNextUnit) { next = new View.OnClickListener() { @Override public void onClick(View v) { hasComponent.navigateNextComponent(); } }; } if (hasPreviousUnit) { prev = new View.OnClickListener() { @Override public void onClick(View v) { hasComponent.navigatePreviousComponent(); } }; } playerFragment.setNextPreviousListeners(next, prev); } try{ FragmentManager fm = getChildFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.player_container, playerFragment, "player"); ft.commit(); }catch(Exception ex){ logger.error(ex); } } if (getUserVisibleHint()) { checkVideoStatusAndPlay(unit); } }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Intent extraIntent = getActivity().getIntent(); if (extraIntent != null) { if (extraIntent.hasExtra(Router.EXTRA_FROM_MY_VIDEOS)) { myVideosFlag = extraIntent.getBooleanExtra( Router.EXTRA_FROM_MY_VIDEOS, false); } if (chapterName == null) { chapterName = extraIntent.getStringExtra("chapter"); } if (lecture == null) { lecture = (LectureModel) extraIntent .getSerializableExtra("lecture"); } if (enrollment == null) { enrollment = (EnrolledCoursesResponse) extraIntent .getSerializableExtra(Router.EXTRA_COURSE_DATA); } } if (chapterName == null) { if (enrollment != null && lecture != null) { if (lecture.chapter != null) { chapterName = lecture.chapter.chapter; } } } if (playerFragment == null) { playerFragment = new PlayerFragment(); playerFragment.setCallback(this); if (environment.getConfig().isVideoTranscriptEnabled()) { playerFragment.setTranscriptCallback(this); } final CourseUnitVideoFragment.HasComponent hasComponent = (CourseUnitVideoFragment.HasComponent) getActivity(); if (hasComponent != null) { View.OnClickListener next = null; View.OnClickListener prev = null; if (hasNextUnit) { next = v -> hasComponent.navigateNextComponent(); } if (hasPreviousUnit) { prev = v -> hasComponent.navigatePreviousComponent(); } playerFragment.setNextPreviousListeners(next, prev); } try { FragmentManager fragmentManager = getChildFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.player_container, playerFragment, "player"); fragmentTransaction.commit(); } catch (Exception ex) { logger.error(ex); } } if (getUserVisibleHint()) { checkVideoStatusAndPlay(unit); } }