Android Open Source - DoItNow Time Picker






From Project

Back to project page DoItNow.

License

The source code is released under:

GNU General Public License

If you think the Android project DoItNow listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.px.do_it_now;
/*from   ww w  . j av  a2s .c om*/
import java.util.Calendar;

import android.app.Dialog;
import android.app.DialogFragment;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.text.format.DateFormat;

public class TimePicker extends DialogFragment implements TimePickerDialog.OnTimeSetListener {

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        // Use the current time as the default values for the picker
        final Calendar c = Calendar.getInstance();
        int hour = c.get(Calendar.HOUR_OF_DAY);
        int minute = c.get(Calendar.MINUTE);

        // Create a new instance of TimePickerDialog and return it
        return new TimePickerDialog(getActivity(), this, hour, minute, DateFormat.is24HourFormat(getActivity()));
    }

  @Override
  public void onTimeSet(android.widget.TimePicker v, int hourOfDay, int minute) {
    // Do something with the time chosen by the user
    //CharSequence text = "Time is set to " + hourOfDay + " : " + minute;
    //Utilities.showMessage(text, v.getContext());
    MainActivity.set_hour = hourOfDay;
    MainActivity.set_min = minute;
  }
}




Java Source Code List

com.px.do_it_now.AlarmReciever.java
com.px.do_it_now.AlarmService.java
com.px.do_it_now.DatePicker.java
com.px.do_it_now.MainActivity.java
com.px.do_it_now.TimePicker.java
com.px.do_it_now.Utilities.java
com.px.do_it_now.WakeIntentService.java