I'm building a little android app where the user would choose a start time for some operation.
I'm using the TimerPickerDialog:
mTimePicker = new TimePickerDialog(getContext(), new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) {
startTimeHours = selectedHour;
startTimeMinutes = selectedMinute;
}, hour, minute, is24hours);
and when a time is selected it returns an int for the hour and int for the minutes, which I save as a global variable.
later in my app I want to convert those numbers into a Time object which I can then use to see if the current time is bigger or smaller than the time represented in that class.
what I've done is this:
Time tStart = new Time(startTimeHours, startTimeMinutes, 0);
but eclips says that this constructor is deprecated. however the constructor that takes long is does not seem to be deprecated.
I looked around and in one post someone recommended to use the Calendar object - but I couldn't figure it out - how to get a new instance of it and set my time. it looks like an overhead for just containing the time.
What is the best practice for such a scenario? if I need to use the constructor that accepts the long variable - how do I convert my 2 integers to that long value?