DatePicker control shown twice in Android >=4.0 under phonegap - android

This is more of question with an answer
We had a problem where a datepicker control would be shown twice after clicking a field of date, we also used a datepicker plugin for phonegap, the problem was that in versions 4.0 of Android the browser handles date fields differently, so the sollutions is either remove type on html field if date or don't use datepicker control.

Related

input date picker on android shows wrong picker on WebView

I've got an HTML5 INPUT (type="datetime-local") in a WebView, but when I select it, it shows a date-time field that looks like this:
But the same identical element in Chrome looks like this:
This is under Android 7.1, with Chrome v55 installed, so Chrome is being used the WebView component. So, both should show the same thing, right?
I need the latter picker to show up in the WebView, it is much more user friendly (to scroll you can just flick up and down rather than having to repeatedly press the plus or minute buttons.
How do I accomplish this?
Update: I have tried creating this natively using a DatePickerDialog and it does the same thing! I'm targeting minSdkVersion=22, targetSdkVersion=25 (although I have also tried minSdkVersion=25). How do I force Android to display the correct picker for my app?
Update 2: I downloaded a sample app using the native DatePickerDialog and it displays the dialog ok. I don't like the idea of having to try to find the difference between the two projects which is causing the behavioral difference as it could be anything and take an excessive amount of time to find.
Update 3: Using the answer provided by Oleg, I was able to reproduce the second picker using android:Theme.Holo.Light.DarkActionBar. But if I use android:Theme.DeviceDefault.Light I can get a calendar view for input type="date". But the corresponding time picker in the Default theme (the round clock) does not show up for input type="time" and ``input type="datetime-local"` doesn't use the calendar view either.
As discussed in comments, you are likely missing the proper theme. Given that you have access to working app, please apply the same theme, it should solve it

How to open a new datepicker displaying an old date in Android tablet

I am working on a C# Android tablet project. If I open a new datePicker, it usually displays the current date. I would like to display a specific date (say, 5/9/2010) in the pop up datePicker. How can I do that? I would appreciate if anyone can help out.
I develop android in Java. In my case I use
DatePicker.init(year, month, day, DatePicker.OnDateChangedListener)
method to initialize the DatePicker before it shows on the screen. I didn't develop android in C#. But I think there must be a similar method to initialize it. Or you can get more information on the API website.

HTML5 date input in android browser

I am building a web page for android user, I use a date form control to allow user input the date, but for most devices, it would not pop out the native date selector, but for some Samsung devices like Note2, it can show the native date selector.
I am wondering is this related by android system version? or related with specific android device? How can I detect if current user have that capability to show the date selector?
right now the level of support for the HTML5 <input type="date"> is very varied so I'd suggest using the jQuery/jQueryUI DatePicker as a more reliable solution
Take a look at How to make the HTML5 input type 'date' trigger the native datepicker on Android? I was able to find a way to have the native android datepicker experience within a web app.

Using the HTML5 date input element with android

The element <input type="date" /> cannot be activated.
When I click on the fields on the emulator it doesn't show me the entrance date but the android keyboard.
Take a look at this: http://www.quirksmode.org/html5/inputs_mobile.html
It tells you which html5 input types and attributes work on each browser. It looks like the datepicker isn't working for most Androids, and thus it would show as a simple text input.
You could use Trigger.io's UI module to use the native Android date / time picker with a regular HTML5 input. Doing that does require using the overall framework though (so won't work as a regular mobile web page).
You can see before and after screenshots in this blog post:
http://trigger.io/cross-platform-application-development-blog/2012/11/16/new-feature-roundup-native-date-time-picker-analytics-with-flurry-android-events/
Have a look here: How to make the HTML5 input type 'date' trigger the native datepicker on Android?
mobiscroll.com offers a nice polyfill.

Android datepicker dialog

How can I disable the day on a datepicker dialog for android? Meant only the month and year is visible. Currently using android 2.2
You can use a custom DatePicker in that case, for exemple refer to this google project that present an alternative time and date picker for android
Sorry but prior to I think 4.0 you cant do this, you only have the option for a full date or full time picker.
You could create your own, but this might take a while, have a look at what others have done.. Heres an example of a full date picker, but you could just take the day out of this as it is xml.
Custom date picker with months and years
Also I think it is a possible duplicate as Custom date picker with months and years
You can do custom date picker using ready to use framework for this.
The Dateslider is a framework for a range of date picker widgets based on the principle of sliding bars. This results in a very intuitive and enhanced user experience.
Check it out it may produce something like to meet your needs.
Thanks

Categories

Resources