Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); restore(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(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { isLandscape = false; } else { isLandscape = true; } if (playerFragment == null) { playerFragment = new PlayerFragment(); playerFragment.setCallback(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); } if (ViewPagerDownloadManager.instance.inInitialPhase(unit)) { ViewPagerDownloadManager.instance.addTask(this); } }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); restore(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); 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); } if (ViewPagerDownloadManager.instance.inInitialPhase(unit)) { ViewPagerDownloadManager.instance.addTask(this); } }