Hello,
The book mentions that DatePickerFragment is hosted on CrimePagerActivity (Page 229).
but in code the DatePickerFragment is launched from CrimeFragment when the user presses the date button :
mDateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FragmentManager manager = getFragmentManager();
DatePickerFragment dialog = DatePickerFragment.newInstance(mCrime.getDate());
dialog.setTargetFragment(CrimeFragment.this, REQUEST_DATE);
dialog.show(manager, DIALOG_DATE);
}
});
This questions is triggered by the use of getActivity() in onCreateDialg() implementation in DatePickerFragmment which according to my understanding is used to pass the hosting activity of a fragment as a context. to whom it is referring here? an explanation would be great.
.
return new AlertDialog.Builder(getActivity()).....
.