Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Bundle bundle = getArguments(); courseData = (EnrolledCoursesResponse) bundle.getSerializable(Router.EXTRA_COURSE_DATA); courseComponentId = bundle.getString(Router.EXTRA_COURSE_COMPONENT_ID); isVideoMode = bundle.getBoolean(Router.EXTRA_IS_VIDEOS_MODE); View view = inflater.inflate(R.layout.fragment_course_outline, container, false); listView = (ListView) view.findViewById(R.id.outline_list); initializeAdapter(); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (deleteMode != null) { deleteMode.finish(); } listView.clearChoices(); CourseOutlineAdapter.SectionRow row = adapter.getItem(position); CourseComponent comp = row.component; if (comp.isContainer()) { environment.getRouter().showCourseContainerOutline(CourseOutlineFragment.this, REQUEST_SHOW_COURSE_UNIT_DETAIL, courseData, comp.getId(), null, isVideoMode); } else { environment.getRouter().showCourseUnitDetail(CourseOutlineFragment.this, REQUEST_SHOW_COURSE_UNIT_DETAIL, courseData, comp.getId(), isVideoMode); } } }); if (isVideoMode) { listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { <START> if (((IconImageView) view.findViewById(R.id.bulk_download)).getIcon() == FontAwesomeIcons.fa_check) { <END> ((AppCompatActivity) getActivity()).startSupportActionMode(deleteModelCallback); listView.setItemChecked(position, true); adapter.getItem(position); return true; } return false; } }); } return view; }</code><technical_language>a good approach if get object function **getItemAtPosition(position)** check attribute if video group of videos downloaded</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Bundle bundle = getArguments(); courseData = (EnrolledCoursesResponse) bundle.getSerializable(Router.EXTRA_COURSE_DATA); courseComponentId = bundle.getString(Router.EXTRA_COURSE_COMPONENT_ID); isVideoMode = bundle.getBoolean(Router.EXTRA_IS_VIDEOS_MODE); View view = inflater.inflate(R.layout.fragment_course_outline, container, false); listView = (ListView) view.findViewById(R.id.outline_list); initializeAdapter(); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (deleteMode != null) { deleteMode.finish(); } listView.clearChoices(); CourseOutlineAdapter.SectionRow row = adapter.getItem(position); CourseComponent comp = row.component; if (comp.isContainer()) { environment.getRouter().showCourseContainerOutline(CourseOutlineFragment.this, REQUEST_SHOW_COURSE_UNIT_DETAIL, courseData, comp.getId(), null, isVideoMode); } else { environment.getRouter().showCourseUnitDetail(CourseOutlineFragment.this, REQUEST_SHOW_COURSE_UNIT_DETAIL, courseData, comp.getId(), isVideoMode); } } }); listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { if (((IconImageView) view.findViewById(R.id.bulk_download)).getIcon() == FontAwesomeIcons.fa_check) { ((AppCompatActivity) getActivity()).startSupportActionMode(deleteModelCallback); listView.setItemChecked(position, true); return true; } return false; } }); return view; }