timepicker

TimePicker onTimeSet not being called

好久不见. 提交于 2019-12-18 03:47:48
问题 I'm using a time picker to let the user enter his desired time to do a specific task, I'm using the DialogFragment class that's available in the support library for backward compatibility with older Android versions. Here is my code to create the TimePickerFragment class, created in a seperate file, taken from: http://developer.android.com/guide/topics/ui/controls/pickers.html : package com.calls.only; import java.util.Calendar; import android.app.Dialog; import android.app.TimePickerDialog;

Date and time picker dialog

风流意气都作罢 提交于 2019-12-17 21:39:42
问题 I want to create a dialog which can select the time and the date at the same time . I know that there is not a default widget that can do that on Android. I also know that there are open source projects on how do similar staff. The problem in this project is that in the dialog we have two buttons: datePicker and timePicker . And that's not what I want to do - I want that the date and time picker appear at the same time. So I think the two main problem will be: First make the time and date

Android: How to get the time from a TimePicker when it is typed in

左心房为你撑大大i 提交于 2019-12-17 18:09:32
问题 I've got a DialogPreference which implements a simple TimePicker.OnTimeChangedListener (see below). Setting the time by clicking the +/- buttons works great. But I don't know how to save the state of the timepicker when the user typed in the time directly into the textfield. It could be sufficient to access to the current textfield value, so I'd be able to persist it in onDialogClosed. But timePicker.getCurrentHour() won't do it. Please help... public class TimePreference extends

How can I override TimePicker to change text color

谁说我不能喝 提交于 2019-12-17 17:15:25
问题 My view has a white background, and it has to stay that way. I have a TimePicker on that white background.Everything is woking fine with android 2.3.3 but android 4.0.3 has a new timePicker style. The numbers have a very bright color. It is very hard to see them on the white background, and I didn't find a direct way to change the textColor. I don't want to change the background because it would look not so good. Is there any way to override this and set the color of the numbers to black?

TimePickerDialog and AM or PM

喜你入骨 提交于 2019-12-17 02:35:18
问题 I have a TimePickerDialog with is24Hour set to false since I want to present the end-user with the more familiar 12 hour format. When the hour, minute and AM PM indicator are set and the time is returned how can I identify whether the end-user has selected AM or PM? This is what I have for the listener: private TimePickerDialog.OnTimeSetListener mTimeSetListener = new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { mHour =

Android, reach Button via DialogFragment?

穿精又带淫゛_ 提交于 2019-12-14 04:22:03
问题 What i want: the buttons text is "08:00" now. When click the button it shows a timepicker. The selected time is set to the buttons text. (Alarm app). i have read some tutorials and questions-answers about this, but haven't find the answers yet. After i press the clock button the app crashes. If i put the onCreateView part in comment it works. it says: android.util.AndroidRuntimeException: requestFeature() must be called before adding content. public class TimeSet extends DialogFragment

Exception of type 'System.InvalidOperationException' occurred in mscorlib.ni.dll but was not handled

断了今生、忘了曾经 提交于 2019-12-13 06:04:06
问题 I am getting this message: " Exception of type 'System.InvalidOperationException' occurred in mscorlib.ni.dll but was not handled in user code " This problem occurs when my TimePicker dont have any time choosen when I leave it empty. My code for the TimePicker looks like this; DateTime break1S = (DateTime)startBreak1.Value; Its on this row i am getting the message but if i set a time for the picker i dont get an message. Any ideas? ** 回答1: If startBreak1.Value is a string : if (startBreak1!=

Get overall hours from two time picker

六月ゝ 毕业季﹏ 提交于 2019-12-13 01:37:17
问题 What is the best way to get the overall total hours from two time picker? I have two different time picker, each time picker has time in and time out. The coding below works fine if the two time picker has filled but doesn't work if only one time picker is filled. Any suggestions would greatly appreciated. SimpleDateFormat format = new SimpleDateFormat("HH:mm"); Date dateb = null; //time in Date datec = null; //time out Date dateb1 = null; //time in1 Date datec1 = null; // time out2 try {

Combining Datepicker and Timepicker values Win 8.1

浪子不回头ぞ 提交于 2019-12-13 01:24:19
问题 I am trying to use a Datepicker + a Timepicker together to return a DateTime that can be stored in a database. For example I would like to have a StartDate and an EndDate (if applicable) to a Meeting scheduled. How would I go about combining the values into the correct format that a SQL database would handle. Any feedback would be great. 回答1: I got this to work. String dateTimeString = ""; DateTime dateTime = DateTime.MinValue; dateTimeString = DateTime.Parse(datePicker.Value.ToString())

Set AM/PM to Time Picker Dialog From String?

℡╲_俬逩灬. 提交于 2019-12-12 20:58:04
问题 I have a TextView in which a time is being show in the format 10:00 PM When user Click on that View, same time must be set to the TimePicker Dialog. I am able to set the Hour and Minutes to the Picker, but in AM/PM section. I always get AM whether user has set AM or PM . How can it be solved? any help is appreciated. Thanks! 回答1: I had Face this Type of Similar issue. it May Be because you might have set your hour element as Below Way hour = String.valueOf(cal.get(Calendar.HOUR)); Try Change