timepicker

android TimePicker

不羁的心 提交于 2019-12-04 05:30:52
在 Android 中关于日期时间的类有 TimePicker 、 DatePicker 、TimePickerDialog、DatePickerDialog、Calendar。其中TimePickerDialog、DatePickerDialog是对话框形式。 一、TimePicker   查看一个在24小时或上午/下午模式下一天的时间。 1.重要方法 setCurrentMinute(Integer currentMinute)设置当前时间的分钟   getCurrentMinute()获取当前时间的分钟   setEnabled(boolean enabled)设置当前视图是否可以编辑。   m_TimePicker.setIs24HourView(true);设置为24小时制显示   setOnTimeChangedListener(TimePicker.OnTimeChangedListener onTimeChangedListener)当时间改变时调用 二、DatePicker   1.重要方法   getDayOfMonth():获取当前Day   getMonth():获取当前月   getYear()获取当前年 三、TimePickerDialog、DatePickerDialog   以对话框形式显示日期时间视图 四、Calendar  

时间与日期选择器——Mars Android开发视频之第一季第十六集(重)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 05:29:29
1· TimePicker的使用方法 TimePicker的样子(4.2版本): 下面,我们来添加一个TimePicker: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TimePicker android:id="@+id/timePicker_1" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> 这样,就添加上了: 1.1 获取用户选择的时间: 声明成员变量: private TimePicker timePicker; 接着获取这个控件: timePicker = (TimePicker) findViewById(R.id.timePicker_1); 然后实现TimePicker的监听器: 当TimePicker的时间发生改变时,就会调用这个监听器;

time picker showing time like 4:7 instead of 04:07

橙三吉。 提交于 2019-12-03 11:07:15
问题 I have a time picker function which sets time in an EditText . But the format it shows is not suitable. for example for 04:07pm is shown as 4:7. whenever the digit in time is less than 10 it removes the 0 automatically. please help me out. My code is if (v == btnTimePicker1) { // Process to get Current Time final Calendar c = Calendar.getInstance(); mHour = c.get(Calendar.HOUR_OF_DAY); mMinute = c.get(Calendar.MINUTE); // Launch Time Picker Dialog TimePickerDialog tpd = new TimePickerDialog

How to set time picker only set time from 8:30 am to 8:30 pm in bootstrap-datetimepicker.js?

怎甘沉沦 提交于 2019-12-03 05:04:27
HTML CODE: <div class="form-group"> <label class="col-md-3 control-label" for="event_date">Start at</label> <div class="col-md-8"> <input id="event_start_date" name="event_start_date" type="text" placeholder="" class="form-control input-md event_date" required=""> </div> </div> <div class="form-group"> <label class="col-md-3 control-label" for="event_date">End at</label> <div class="col-md-8"> <input id="event_end_date" name="event_end_date" type="text" placeholder="" class="form-control input-md event_date" required=""> </div> </div>` JavaScript code: $('#event_start_date').datetimepicker({

Get date and time picker value from a single dialog fragment and set it in EditText

♀尐吖头ヾ 提交于 2019-12-03 02:54:14
问题 I am working on an application in which the user can set the date and time. I want to set the date and time in a single dialog fragment and set it to edit text. Is it possible to use a date and time picker in 1 dialog fragment? If it is, how do you do it? Currently I am getting the time from the dialog fragment and then setting it to the EditText . My code is LaterTextView=(TextView)findViewById(R.id.PickUp_later_TextView); LaterTextView.setOnClickListener(new View.OnClickListener() {

TimePicker in PreferenceScreen

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'd like to create a preference field called Interval and I want to be able to popup a TimePicker and set a mm:ss formated value with minimal value 00:30 and step 30 seconds. Is it possible to use TimePicker in PreferenceScreen ? 回答1: There is no TimePreference built into Android. However, creating your own is fairly easy. Here's one I did : import android.content.Context; import android.content.res.TypedArray; import android.preference.DialogPreference; import android.util.AttributeSet; import android.view.View; import android.widget

jQuery日期和时间插件 jquery-ui-timepicker-addon.js

匿名 (未验证) 提交于 2019-12-02 21:53:52
官网地址: http://trentrichardson.com/examples/timepicker/ 官网demo下载: https://github.com/trentrichardson/jQuery-Timepicker-Addon 插件效果图: HTML <script src="/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script> js //初始化 $(function () { //日期 var dayNamesMin = ["日", "一", "二", "三", "四", "五", "六"]; var monthNamesShort = ["01月", "02月", "03月", "04月", "05月", "06月", "07月", "08月", "09月", "10月", "11月", "12月"]; $.timepicker.regional['ru'] = { timeText: "选择时间", hourText: "小时", minuteText: "分钟", secondText: "秒", millisecText: "毫秒", currentText: "当前时间", closeText: "确定", ampm: false, }; $.timepicker

Showing TimePickerDialog fragment error

雨燕双飞 提交于 2019-12-02 20:37:05
问题 I am trying to launch a timepicker from a button in a fragment I've read post regarding the same problems about the Error but the codes doesn't match on what I have started thats why i posted this TimePickerFragment.java public class TimePickerFragment extends DialogFragment { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Calendar c = Calendar.getInstance(); int cHour= c.get(Calendar.HOUR_OF_DAY); int cMinute = c.get(Calendar.MINUTE); return new TimePickerDialog

Using DatePicker and TimePicker dialog boxes - Android Java in Eclipse

懵懂的女人 提交于 2019-12-02 17:20:03
问题 I have no errors on the code, but when I launch I get a fatal error in my main XML page that says, 03-21 22:00:31.849: E/AndroidRuntime(606): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{countrycabin.ist236/countrycabin.ist236.Main}: java.lang.NullPointerException I'm not sure what is causing the problem. As I said, I have no errors. I made a program very similar to this that worked fine, I just added the TimePicker to this one. What I'm trying to do is pretty

Using DatePicker and TimePicker dialog boxes - Android Java in Eclipse

隐身守侯 提交于 2019-12-02 11:42:01
I have no errors on the code, but when I launch I get a fatal error in my main XML page that says, 03-21 22:00:31.849: E/AndroidRuntime(606): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{countrycabin.ist236/countrycabin.ist236.Main}: java.lang.NullPointerException I'm not sure what is causing the problem. As I said, I have no errors. I made a program very similar to this that worked fine, I just added the TimePicker to this one. What I'm trying to do is pretty straightforward. I'm making the program launch, and when I click a button, a dialog displays that shows