Easy Challenge dialog showing up blank


#1

I carefully followed the steps from chapter 12 to create another dialog for the time. However, the dialog is showing up on the emulator as a white strip across the screen (no title, no TimePicker, no PositiveButton). Can I have some guidance as to why this is occurring? I have included some pieces of relevant code:

TimePickerFragment.java:
public Dialog OnCreateDialog(Bundle savedInstanceState) {
View v = getActivity().getLayoutInflater().inflate(R.layout.dialog_time, null);
return new AlertDialog.Builder(getActivity())
.setView(v)
.setTitle(R.string.time_picker_title)
.setPositiveButton(android.R.string.ok, null)
.create();
}

CrimeFragment.java:
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {

mTimeButton = (Button)v.findViewById(R.id.crime_time);
updateTime();
mTimeButton.setOnClickListener(new View.OnClickListener()
{ @Override
public void onClick(View v) {
FragmentManager fm = getActivity().getSupportFragmentManager();
TimePickerFragment dialog = TimePickerFragment.newInstance(mCrime.getDate());
dialog.setTargetFragment(CrimeFragment.this, REQUEST_DATE);
dialog.show(fm, DIALOG_DATE);
}
});

return v;
}


#2

I found the error myself, after 2 days of frustration.

I had a capital “O” in OnCreateDialog where it should have been onCreateDialog. Eclipse didn’t point out the error because I didn’t use @Override…lesson learned the hard way!