Following the Android SDK tutorials I have implemented my first basic date picker dialog. It works fine but is there any way to change the format of the date shown?
Example:
The date picker dialog displays the date as "17 Oct 2010". I would it like to be displayed as "17 10 2010".
Greetings,
Robert
I think you have to extend the DatePicker class with your own, and modify it as you like. Afaik there are no attributes that you could use to easily modify this.
Related
hello guys I am developing an application and I need to display a date picker. This date picker needs to display only the year. Does any one know how to limit the date picker to show only years.
kind regards
and thanks
You can set its bounds using:
setMinDate(long minDate)
setMaxDate(long maxDate)
You can create your custom date picker using Spinner(populated with year you want) in Dialog box. How to make an alert dialog with a spinner
is there any datepicker in Android, which I can use for selecting dates BC and AD ?
or do I have to create my own one ?
By default datepicker in Android only goes to 1970.
You can somewhat manipulate the date though.
For help with creating a custom datepicker, you can try here.
I have date picker like this.
The one I want is this.
what am I supposed to do?
well it looks like it is a background image. So you need to find a background image then synchronize it to your date picker .
I need to select more than once date from a CalenderView of android. Can any one help me to do the same.
Example!
Let's look attached image. If we consider the calender in image as CalenderView of android I need to select all date raging from 16th to 20th.
As far as I know the CalendarView only supports selecting single dates.
I would suggest calling it twice to get the start and end dates (for the end date, you could call setMinDate() beforehand to make sure it's greater than the start date).
I made a custom DatePicker that extends the android DatePicker UI component. I needed this to make possible the visibility option for each DatePicker's view component(day,month and year).
I made this possible by hiding the views from DatePicker by its index.
I get the index of each component by getting the date format order like this DateFormat.getDateFormatOrder(context) , this returns a char array like {m, d, y} so I can get the order of the DatePicker components and hide them..
The problem I run into is that on some devices the DatePicker position its components by the selected locale of the user and not by the selected date format.
How can I get the DatePicker's components order? Or how I can figure out that DatePicker will position its components by locale or date format?
Note that I am developing this on Android API level 2.1++ and I would prefer not to make my own DatePicker so I can preserve the android DialogPicker UI theme.
Thank you!
And unfortunately the answer is: I had to develop my own DatePicker and now everything works fine