OK. I have spent hours on this and I can't figure it out. I have created a separate Class that has the datepickerdialog fragment as follows:
public abstract class DatePickerFragment extends DialogFragment implements
DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
// Create a new instance of DatePickerDialog and return it
return new DatePickerDialog(getActivity(), this, year, month, day);
}
}
The code that calls this fragment is:
textViewToChange.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
DialogFragment newFragment = new DatePickerFragment() {
public void onDateSet(DatePicker view, int year, int month, int day) {
//TODO some stuff here
changed = true;
}
};
newFragment.show(getSupportFragmentManager(), "datePicker");
return changed;
}
});
I have tried everything I could read and I just can't figure out how to set the title. The title that shows up is today's date. I want to set the title and also add an icon. Any help would be great!