Solved

Android Java DatePickerDialog. How do I set the initial date value?

Posted on 2012-04-02
3
918 Views
Last Modified: 2012-04-02
This is hopefully a simple one.  I've been looking for ages but just can't find a solution.

I'm using showDialog to pop up the DatePickerDialog.  All aspects of this are fine.

I can't find out how to set the initial value the DatePickerDialog shows.  

I know you can set the value once in the onCreateDialog but I need to set it every time I show the dialog not just when its created.

I'm guessing there is some kind of object I can access I just can't find it anywhere.

Many Thanks
0
Comment
Question by:SamSherwin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 24

Assisted Solution

by:alexey_gusev
alexey_gusev earned 250 total points
ID: 37796120
first of all, you have updateDate().
then, onPrepareDialog() is called every time you use showDialog()
0
 
LVL 8

Accepted Solution

by:
Santhana earned 250 total points
ID: 37796225
Hi  SamSherwin,

Refer this from android docs
http://developer.android.com/guide/topics/ui/dialogs.html

Before the dialog is displayed, Android also calls the optional callback method onPrepareDialog(int, Dialog). Define this method if you want to change any properties of the dialog each time it is opened. This method is called every time a dialog is opened, whereas onCreateDialog(int) is only called the very first time a dialog is opened. If you don't define onPrepareDialog(), then the dialog will remain the same as it was the previous time it was opened. This method is also passed the dialog's ID, along with the Dialog object you created in onCreateDialog().
0
 

Author Closing Comment

by:SamSherwin
ID: 37796255
Thanks for the quick and good solution(s).  Sometimes when under pressure you just can see the wood for the trees.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Q: Not able to define my Hotmail on my new Samsung S5 ? 10 54
moto 4g phone enable finger print 4 44
swing controls 2 21
How to fix  socket closed error 11 24
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
A short article about a problem I had getting the GPS LocationListener working.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question