Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7567901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:47:08+00:00 2026-05-30T14:47:08+00:00

How can I add a simple calendar that when a user clicks on the

  • 0

How can I add a simple calendar that when a user clicks on the “Birthdate field” it will direct to another page or a pop-up box that has a calendar and so the user can select the date of his/her birth? I am developing an android application in eclipse with PhoneGap 1.4.1, Many Thank you guys.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:47:09+00:00Added an answer on May 30, 2026 at 2:47 pm

    Here is what I did:

    Create a Calendar instance for default value:

    //class level variables
    private int mYear;
    private int mMonth;
    private int mDay;
    static final int DATE_DIALOG_ID = 0;
    private DatePickerDialog.OnDateSetListener mDateSetListener;
    
    //inside onCreate
    final Calendar c = Calendar.getInstance();
        mYear = c.get(Calendar.YEAR)-20;
        mMonth = c.get(Calendar.MONTH);
        mDay = c.get(Calendar.DAY_OF_MONTH); //Default DOB is (today - 20) years
    
      //date picker things
        mDateSetListener = new DatePickerDialog.OnDateSetListener() {
            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                        mYear = year;
                        mMonth = monthOfYear;
                        mDay = dayOfMonth;
                        updateDisplay();
                    }
        };
    

    A function to update Date of Birth EditText field:

    private void updateDisplay() {
        et_dob.setText(new StringBuilder().append(mMonth+1).append("/").append(mDay).append("/").append(mYear).append(" "));
        //month is 0 based so 1 is added in mMonth;
    }
    

    onClickListener on et_dob

    showDialog(DATE_DIALOG_ID); //DATE_DIALOG_ID = 0;
    

    Then override onCreateDialog in your activity:

    @Override
    protected Dialog onCreateDialog(int id) {
        // TODO Auto-generated method stub
        switch (id) {
        case DATE_DIALOG_ID:
            return new DatePickerDialog(this,
                        mDateSetListener,
                        mYear, mMonth, mDay);
        }
        return null;        
    }
    

    You should see something like this when you click on EditText et_dob.

    DatePicker

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I add a simple hover to a div that will be compatible
When you edit a simple page in the design view, you can add an
My question is simple. Can I add either of the blow :prompt => Any
Simple. If I use: public void Add(params int[] values) Then I can use this
Well, it seems simple enough, but I can't find a way to add a
I know that I can add a HintPath to an external DLLs to help
How can I simple add image to selectbox? I found few jQuery plugins, but
I have a relatively simple Backbone handled message container. I can add messages, and
I want to add simple list/combo box with action script 3 . but i
Is there a simple way I can add a WikiField to a model I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.