I have worked my through the book to the end of Chapter 13 (for a college class), and am now tasked with created my own app from scratch. It’s similar in functionality to the Criminal Intent, so I’m basing my underlying code on that. However, in order for me to get a better grasp on how things actually work with Criminal Intent, I’m trying to understand what getActivity actually returns.
For example in this case from CrimeListFragment.java:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View view = inflater.inflate(R.layout.fragment_crime_list, container, false);
mCrimeRecyclerView = view.findViewById(R.id.crime_recycler_view);
mCrimeRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
if(savedInstanceState != null){
mSubtitleVisible = savedInstanceState.getBoolean(SAVED_SUBTITLE_VISIBLE);
}
updateUI();
return view;
}
What is the actual value passed back from getActivity? What activity is being passed out of here? CrimeListFragment? CrimeListActivity? Something else?