android-datepicker

DatePicker crash in samsung with android 5.0

萝らか妹 提交于 2019-11-29 05:27:35
问题 I am having trouble with creating a datepicker in samsung note 2 device with lollipop 5.0. The exception is: java.util.IllegalFormatConversionException: %d can not format java.lang.String arguments at java.util.Formatter.badArgumentType(Formatter.java:1489) at java.util.Formatter.transformFromInteger(Formatter.java:1689) at java.util.Formatter.transform(Formatter.java:1461) at java.util.Formatter.doFormat(Formatter.java:1081) at java.util.Formatter.format(Formatter.java:1042) at java.util

Setting time and date to date picker and time picker in android

你。 提交于 2019-11-29 05:24:11
I am using a date picker and time picker in my application. I want to set the date and time when the page loads. Is this possible? How so? I solved a similar problem of mine as follows Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); int hour = cal.get(Calendar.HOUR_OF_DAY); int min = cal.get(Calendar.MINUTE); datePicker.updateDate(year, month, day); timePicker.setCurrentHour(hour); timePicker.setCurrentMinute(min); Using JodaTime JodaTime is an extremely popular and useful library for

Still able to select disabled dates in date picker

感情迁移 提交于 2019-11-29 04:09:41
I want to disable the past dates of date picker in android. i can do it by using dialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000); This is working fine and the past dates in date picker looks disabled. But I can still click on a previous date and select it. How to not let that happen ? below is the screenshot of my date picker :- And here is my code where I am disabling the past dates :- @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the picker final Calendar c = Calendar.getInstance(); int year = c.get

datepicker with different style than activity

隐身守侯 提交于 2019-11-29 00:14:50
I have activities with custom style, I want my activity with a custom title bar so I created below style: <style name="costum_titlebar"> <item name="android:background">@color/titlebar_background</item> </style> <style name="CustomTheme" parent="android:Theme"> <item name="android:windowTitleSize">@dimen/titlebar_size</item> <item name="android:windowTitleBackgroundStyle">@style/costum_titlebar</item> </style> In manifest I use: <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/CustomTheme" > In the activity I

Android how to show DatePicker in Fragment?

送分小仙女□ 提交于 2019-11-28 22:54:33
问题 I am new on Android Fragments and I want to know that how can I show or implement DatePicker in simple Fragment and not a FragmentActivity . For example my class name is: public class FragmentAddCard extends Fragment { } Thanks. 回答1: In your button click call the DateFragment like this dob.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { DialogFragment newFragment = new SelectDateFragment(); newFragment.show(getFragmentManager(), "DatePicker"); } });

Casting and getting values from date picker and time picker in android

浪子不回头ぞ 提交于 2019-11-28 22:44:47
I have a DatePicker and a TimePicker in my app. Can anyone tell me how to get the values of the date and time that are selected??? What i mean to say is, for EditText we can declare as final EditText name = (EditText) this.findViewById(R.id.nametext); and we can cast the data of it by using name.getText().toString() . So similarly how can we get the values of DatePicker and TimePicker to a String??? Jim Blackler DatePicker has getYear() getMonth() getDayOfMonth() to make a Date object from a DatePicker you'd do new Date(datePicker.getYear() - 1900, datePicker.getMonth(), datePicker

Setting MinDate on DatePicker moves CalendarView to 1964

放肆的年华 提交于 2019-11-28 19:35:33
I'm debugging an issue where the CalendarView in a DatePicker moves to October 1964 if there is a non-default minimum date set. This reproduces at least on API17 Nexus7 emulator but there are reports about this issue on other devices where the platform style includes both spinners and calendar view in date picker. Here's a code snippet demonstrating the issue: class DatePickerDialog1964 extends DatePickerDialog { DatePickerDialog1964(Context c) { super(c, null, 2013, 4, 21); @SuppressWarnings("deprecation") Date min = new Date(2013-1900, 4, 21); DatePicker p = getDatePicker(); p.setMinDate(min

How to show DatePickerDialog on Button click? [closed]

风流意气都作罢 提交于 2019-11-28 19:06:31
I'm developing an app that requires user to select date(dd/mm/yyyy). I want to show a dialog box with DatePicker on button click. once date is selected it must show in EditText. I'm using Android Studio 2.2, project with min sdk is 23. Kindly help me to do required code. I. In your build.gradle add latest appcompat library, at the time 24.2.1 dependencies { compile 'com.android.support:appcompat-v7:X.X.X' // where X.X.X version } II. Make your activity extend android.support.v7.app.AppCompatActivity and implement the DatePickerDialog.OnDateSetListener interface. public class MainActivity

Android DatePicker : Disabling the PREVIOUS dates based on the CURRENT date

孤者浪人 提交于 2019-11-28 09:33:55
问题 I have a DatePicker in my app which is set in this way : Layout : <TextView android:id="@+id/traveltext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.11" android:text="Date Of Travel" android:textStyle="bold" /> <EditText android:id="@+id/txtDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" > </EditText> <Button android:id="@+id/btnCalendar" android:layout_width="30dp" android:layout

How to show DatePickerDialog on Button click? [closed]

女生的网名这么多〃 提交于 2019-11-27 20:21:25
问题 I'm developing an app that requires user to select date(dd/mm/yyyy). I want to show a dialog box with DatePicker on button click. once date is selected it must show in EditText. I'm using Android Studio 2.2, project with min sdk is 23. Kindly help me to do required code. 回答1: I. In your build.gradle add latest appcompat library, at the time 24.2.1 dependencies { compile 'com.android.support:appcompat-v7:X.X.X' // where X.X.X version } II. Make your activity extend android.support.v7.app