So on a page of my app, there are two EditText fields (editEarliestDepart and editLatestDepart).

I'd like two things to happen:

When a user clicks one of them, I'd like for a TimePicker fragment dialog to appear. After a user sets the time, the values will get passed to, and displayed in, the EditText field that was just selected. When user sets "editLatestDepart", ensure that "editLatestDepart" always comes after "editEarliestDepart".

Can anyone please help me figure this out? I've been trying for days, and it's driving me mad.

Thank you,

Kevin

The Activity that calls the Timepicker fragment dialog.

public class NewDriverSetupTime extends FragmentActivity implements TimePickedListener { String pickerHour, pickerMinute; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_driver_setup_time); //create on click listener for earliest depart EditText earliestDepart = (EditText) findViewById(R.id.editEarliestDepart); earliestDepart.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DialogFragment newFragment = new TimePickerDialogFragment(); newFragment.show(getFragmentManager(), "timePicker"); } }); //create on click listener for latest depart EditText latestDepart = (EditText) findViewById(R.id.editLatestDepart); latestDepart.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DialogFragment newFragment = new TimePickerDialogFragment(); newFragment.show(getFragmentManager(), "timePicker"); } }); } @Override public void onTimePicked(Calendar time) { // TODO Auto-generated method stub // display the selected time in the clicked editview } }

Here is the actual Fragment code