android-datepicker

DatePickerDialog.OnDateSetListener does not get a callback on Samsung devices

与世无争的帅哥 提交于 2019-12-10 18:13:52
问题 For some weird reason, when i click on the positive button as part of the DatePickerDialog, the onDateSet method as part of the DateSetListener does not get invoked ONLY ON SAMSUNG DEVICES . Here is what i am doing : DateSetListener _datePickerDialogCallback = new DateSetListener(); DatePickerDialog _datePickerDialog = new DatePickerDialog(context, _datePickerDialogCallback, year, month, days); _datePickerDialog.setButton(DialogInterface.BUTTON_POSITIVE, StringUtil.getString(R.string.command

Android API 21 22 datepicker year selection bug?

半城伤御伤魂 提交于 2019-12-10 15:59:34
问题 I've implemented the "calendar view", i.e., lollipop version of Android's Datepicker. There's a difference between Android API 21 & 22 in the year selection of said datepicker when I click on "2015" to change the year: using API21 using API22 I'm using a Nexus 5 simulator. I'm only seeing the current (2015) year entry in API22, whereas in API21, I can scroll through from ~1950 to ~2100. Same code and, as far as I can tell, same simulation settings. I'm wondering if this is just a bug, if

Date picker inside custom dialog in Android

巧了我就是萌 提交于 2019-12-10 15:19:05
问题 I wanted to use date picker inside my custom dialog. On button click calendar will open to choose date for user. I have Button inside my customDilaog class and on that button click I want to open calendar view. My app crashes if click this button. I have done with this. CustomDialog.java public class CustomDialog extends Dialog implements android.view.View.OnClickListener { private Button date; DateFormat format = DateFormat.getDateInstance(); Calendar calender = Calendar.getInstance();

Validating “from date” and “to date” in android

China☆狼群 提交于 2019-12-10 14:53:08
问题 I an application in which user has to choose two dates namely- from date and to date .Both the fields should not accept any date less than current date.I have gone through some posts in this website and achieved this functionality by using single datepicker dialog and single ondatesetListener. my problem is that i am unable to validate the condition that to date should be always greater than or equal to from date .please help me.I am unable to capture the from date as the active date is

how to restrict user to select date of birth who is under 21 years in android

浪尽此生 提交于 2019-12-10 11:56:01
问题 I am using DatePickerDialog to select the users date of birth.How to restrict user to select date of birth who is under 21 years from current date. Eg:the users date of birth after 14/6/1996 should be restricted from selecting This is my code, Date today = new Date(); Calendar c = Calendar.getInstance(); c.setTime(today); c.add( Calendar.YEAR, -21 ); minDate= c.getTime().getTime(); Log.v(Constants.TAG, "selecteddsdf " + minDate); public void showDatePickerDialog(View v) { datePickerDialog =

white background for date picker dialog shadow

无人久伴 提交于 2019-12-10 10:02:11
问题 I add datepicker to my application but my problem the shadow for the dialog have white background , use Android 21 for compile . please help me to remove white background ... 回答1: You have a "bug" in your themes.xml or styles.xml material design support library is not working properly with dialogs. So remove the specific dialog code or separate it in different versions. Trying to explain a little bit further. Generally when we extend the original application theme we have an themes.xml and/or

How to change Number Picker center text color in Android

烈酒焚心 提交于 2019-12-10 03:59:28
问题 I have implemented a custom Date Picker wherein I need to have custom colors for the number picker (Date picker uses Number picker inside) inside it as follows: With the help of this answer I could make it look like this: But as you see the actual date is getting shown in the yellow color instead of white. Moreover, I tried doing it at run time like this: npMonth.setOnValueChangedListener(new OnValueChangeListener() { @Override public void onValueChange(NumberPicker picker, int oldVal, int

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

SetMax date to 30 days in Android Date Picker

こ雲淡風輕ζ 提交于 2019-12-08 01:08:03
问题 I'm using a Material design library for Datepicker . I need to set min and max date. The min date works but I am not able to get the max date which should be 30 days from the min date(current date) . Can anyone know how to make it work here? public void show() { Calendar now = Calendar.getInstance(); DatePickerDialog dpd = DatePickerDialog.newInstance( PostInfo.this, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH) ); dpd.setMinDate(Calendar.getInstance());

Max Date on an Android DatePickerDialog

杀马特。学长 韩版系。学妹 提交于 2019-12-07 13:14:12
问题 I need to set a max year on the DatePickerDialog that I am using but I am unable to find any mechanism of doing that. The documentation mentions getDatePicker () as a public method of the DatePickerDialog. So, I thought, perhaps, that can be used to get the DatePicker and then I could set the max date but I get "Method undefined" error when I try to get the DatePicker. This is how I am trying to get the DatePicker inside my onCreateDialog. DatePickerDialog d = new DatePickerDialog(this, dep