public
void
showTimePickerDialog()
{
OnTimeSetListener callback=
new
OnTimeSetListener() {
public
void
onTimeSet(TimePicker view,
int
hourOfDay,
int
minute) {
String s=hourOfDay +
":"
+minute;
int
hourTam=hourOfDay;
if
(hourTam>
12
)
hourTam=hourTam-
12
;
txtTime.setText
(hourTam +
":"
+minute +(hourOfDay>
12
?
" PM"
:
" AM"
));
txtTime.setTag(s);
cal.set(Calendar.HOUR_OF_DAY, hourOfDay);
cal.set(Calendar.MINUTE, minute);
hourFinish=cal.getTime();
};
String s=txtTime.getTag()+
""
;
String strArr[]=s.split(
":"
);
int
gio=Integer.parseInt(strArr[
0
]);
int
phut=Integer.parseInt(strArr[
1
]);
TimePickerDialog time=
new
TimePickerDialog(
MainActivity.
this
,
callback, gio, phut,
true
);
time.setTitle(
"Chọn giờ hoàn thành"
);
time.show();
}
/**
* Hàm xử lý đưa công việc vào ListView khi nhấn nút Thêm Công việc
*/
public
void
processAddJob()
{
String title=editCv.getText()+
""
;
String description=editNd.getText()+
""
;
JobInWeek job=
new
JobInWeek(title, description, dateFinish, hourFinish);
arrJob.add(job);
adapter.notifyDataSetChanged();
editCv.setText(
""
);
editNd.setText(
""
);
editCv.requestFocus();
}
}
0 nhận xét:
Đăng nhận xét