Question

I am currently building a web based application and would like to use the native Android date picker for a field. I have looked into using PhoneGap but it seems to be more than I need for my project. Is there anyway to invoke the date picker field with basic JavaScript?

Also, I am not looking to use jQuery Mobile as the CSS for it completely disables my current look.

Was it helpful?

Solution

On Android you cannot inwoke the native datepicker from a web app (input type="date" would be the correct way, which is supported on iOS > 5).

I recommend using Mobiscroll, which is a javascript datepicker (and not just datepicker) plugin, which has themes to make it look like the native date picker.

OTHER TIPS

I'm pretty sure the answer to your question is "no". PhoneGap works by having native libraries for each platform that are accessible through a Javascript API -- without the native libraries, I don't think you will be able to invoke the date picker field.

That said, PhoneGap is an open source project, so you can always analyze their source, and see what would be necessary to implement it. The PhoneGap code for Android is here:

https://github.com/apache/incubator-cordova-android

I googled the PhoneGap datapicker plugin, and came across this

https://github.com/phonegap/phonegap-plugins/tree/master/Android/DatePicker

I think this is what you are looking for, but I did not test it personally.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top