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

  • SEARCH
  • Home
  • 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 9226335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:48:18+00:00 2026-06-18T04:48:18+00:00

first let me say that I’m quite new to Android, so sorry if this

  • 0

first let me say that I’m quite new to Android, so sorry if this question is really simple, but I couldn’t find an answer for it in SO or Google.

I’m doing a small app for training and I I have this datePicker object:

<DatePicker
    android:id="@+id/datePicker1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/editText2"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="64dp"
    android:calendarViewShown="false"
    android:spinnersShown="true"
    android:onClick="selectDate" />

So, I’ve set up an onClick connection to a selectDate function I have:

public void selectDate(View view) {
    datePick = (DatePicker) findViewById(R.id.datePicker1);
    int yy = datePick.getYear();
    int mm = datePick.getMonth();
    int dd = datePick.getDayOfMonth();
    Calendar calendar = Calendar.getInstance();
    calendar.set(yy, mm, dd);
    int doy = calendar.get(Calendar.DAY_OF_YEAR);
    populateDayOfYear(doy);
}

But the app doesn’t do what is expected of it, and in fact after debuging, it never even enters this function.

So, just to be clear, what I want is to update a value (with the doy in the populateDayOfYear(doy)) of a EditText field every time I change a value in my datePicker, I don’t want to press a button and be taken to a DatePickerDialog and only then be able to update the EditText field.

Is it possible with the standard datePicker or do I need to build one by myself?

  • 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-06-18T04:48:19+00:00Added an answer on June 18, 2026 at 4:48 am

    Try this in OnCreate

    datePick = (DatePicker) findViewById(R.id.datePicker1);
    datePick.init(2012,1,1,  new DatePicker.OnDateChangedListener(){
    
       public void onDateChanged(DatePicker view, int yy, int mm, int dd){
          Calendar calendar = Calendar.getInstance();
          calendar.set(yy, mm, dd);
          int doy = calendar.get(Calendar.DAY_OF_YEAR);
          populateDayOfYear(doy);
       }
      }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question, but let me first say that this is being performed
First let me say that I really feel directionless on this question. I am
First let me say that I'm very new to android development (although I have
Let me first say that I have quite a lot of Java experience, but
Let me first say that I realize this question is vague and does not
First of all, let me say that I'm relatively new to SOAP/WSDL/API, so this
First let me say I really sorry for asking a question about facebook. I'm
First let me say that I did see this article: How to remove AspxAutoDetectCookieSupport
I can't figure this one out. At first let me say that my cache
Let's say that there are two PHP functions. function first() { $keyword = $this->input->post('keyword');

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.