Inside of the
onTimeSet()
method, you are only using
time1Text
.
In your current implementation, the
View
object that is passed to
onClick()
is the
EditText
that was clicked. Taking that into consideration, my suggestion would be something like:
@Override
public void onClick(View v)
{
Calendar c = Calendar.getInstance();
mHour = c.get(Calendar.HOUR_OF_DAY);
mMinute = c.get(Calendar.MINUTE);
TimePickerDialog tpd = new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener()
{
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute)
{
((EditText) v).setText(hourOfDay + ":" + minute);
}
}, mHour, mMinute, false);
tpd.show();
}