android-timepicker

How do I display date and time separately from a give datetime function?

℡╲_俬逩灬. 提交于 2019-12-13 07:17:03
问题 I am just plugging and playing with a sample code to get a hang of chatting/messaging apps. I am using a function gettimedate such that, in my model class I have the following: private volatile long mTimedate; public myclass(....,DateType date,...){ mTimedate = date != null ? date.time : new Date().getTime(); } public final long getTimedate() { return mTimedate; } public int hashCode() { if (mId != null) { return mId.hashCode(); } int hash = mBody == null ? 0 : mBody.hashCode(); return 31 *

Removing AM/PM in Android Time picker Widget

百般思念 提交于 2019-12-12 21:14:57
问题 Is there any way to remove the AM/PM in a Time Picker Widget ? I have this function in my application but its purpose is to select only Hour and Minutes not including AM/PM, I tried to setIs24HourView(true) but it makes the time 24hours, I only want 12 hours. 回答1: It seems there is no public method in TimePicker to directly hide or show the AM/PM chooser. However, a look at the source code will give us the name of the resource ID for that View , which we can get with the system Resources .

How to disable keyboard in TimePickerDialog android?

时光毁灭记忆、已成空白 提交于 2019-12-11 15:29:14
问题 I am using timepicker and datepicker in my app. i want to disable keyboard in both these. i am able to disable keyboard in date picker with below code. datePickerDialog.getDatePicker().setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); but not getting how to disable keyboard in timepickerdialog. i tried below popular example but still no use public class TimePickerFragment extends DialogFragment implements TimePickerDialog.OnTimeSetListener { private TimePickerDialog

How to set the text at particular id in dynamic generated Button

强颜欢笑 提交于 2019-12-11 01:27:55
问题 I have the following code. In this i have dynamically generated buttons.when click the button it shows the timepicker. My problem is to set the time for clicked button but it set the text at the last button how to set the value at clicked button... public void addButton(int value) { list.removeAllViews(); for (i=0 ; i < value; i++) { button = new Button(this); button.setText("Add Time"); button.setId(i); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { Calendar

How to set min date in TimePickerAndroid for react-native

别来无恙 提交于 2019-12-10 19:44:31
问题 I created a simple form with react-native using this library with start time and end time. I was asking my self why I can set with no problem the start time and end time on ios, but I cannot set it in android when I found in the official documentation that it isn't expected the min time option. Does exist any workaround or some hack to solve this problem? The code is so similar to the one in the example so I didn't provide it, but in the case I can edit the message. Thanks 回答1: According to

Limit Time Range in Time Picker

谁说胖子不能爱 提交于 2019-12-10 14:17:31
问题 How to control TimePicker, I just want to show time range in time picker from 08:00 am to 02:00 pm (except from 08:00 am to 02:00 pm hide all) I have written complete code to show TimePicker, and customized time as well. Here is my code: case DIALOG_TIME: 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(this, lisTime, hour, minute,

how do i compare current date with user input date from date picker

萝らか妹 提交于 2019-12-09 01:38:07
问题 I am trying to keep constraint on date and time. I want that if user tries to set date less than current date then it should show alert, and same thing is to be done with time. I am using date and time pickers and my onDateSetListener and onTimeSetListener are as below: DatePickerDialog.OnDateSetListener d = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { dateTime.set(Calendar.YEAR, year); dateTime.set

Changing TimePickerDialog Styles

烂漫一生 提交于 2019-12-08 17:54:25
I want to change the style of my TimePicker but I can't get to change the color of the clock face and the header background. Here's my XML style code - <style name="DateTimeDialog" parent="Theme.AppCompat.Dialog"> <item name="android:colorBackground">@color/colorWhite</item> <item name="android:textColorPrimary">#000000</item> <item name="android:headerBackground">#000000</item> <item name="android:textColorSecondary">#000000</item> <item name="android:button">@color/colorWhite</item> <item name="android:colorPrimaryDark">@color/colorPrimaryDark</item> <item name="android:colorAccent">@color

Time Picker Dialog crash on Samsung S4 OS 4.3

寵の児 提交于 2019-12-08 17:12:42
问题 I keep on getting this issue whenever I click on Timepicker. This issue is not occurring on any other devices, Following is the error log: Error log: java.lang.NullPointerException at android.widget.TimePicker.updateInputState(TimePicker.java:846) at android.widget.TimePicker.onSaveInstanceState(TimePicker.java:561) at android.view.View.dispatchSaveInstanceState(View.java:13117) at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:2822) at android.view.ViewGroup

How to change the default color scheme timepicker dialog fragment?

女生的网名这么多〃 提交于 2019-12-07 23:56:31
问题 I am trying to change the default color the timepicker dialog fragment. and right now i have no idea as to what im supposed to be doing. this what i have managed to set my theme to (withouth the actionBar): but this is the dialog i get: this is my xml style file: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="AppTheme" parent="Theme.AppCompat.Light"> <item name="colorPrimary">@color/color_accent</item> <item name="colorPrimaryDark">@color/color_secondary</item> <item name=