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 8255449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:31:44+00:00 2026-06-08T01:31:44+00:00

I am developing an android application using IntelliJ IDEA 11.1.2 and I need datepicker

  • 0

I am developing an android application using IntelliJ IDEA 11.1.2 and I need datepicker on my input form. However, when I insert it, IDEA gives “Missing class DatePicker” warning in the preview window and I launch application on the phone it crashes. If I remove datepicker element, application works properly.

I am using android 2.2 as a target platform and java 1.6 as java SDK.

Here’s source code of my form:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id = "@+id/l_main"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView
    android:text="Some text: "
    android:layout_width="fill_parent"
    android:textSize="@dimen/fnt_size"
    android:layout_height="wrap_content"
    />
<EditText
    android:id="@+id/source"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    />
<TextView
    android:text="Some text: "
    android:layout_width="fill_parent"
    android:textSize="@dimen/fnt_size"
    android:layout_height="wrap_content"
    />
<EditText
    android:id="@+id/destination"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    />
<TextView
    android:text="Some text: "
    android:layout_width="fill_parent"
    android:textSize="@dimen/fnt_size"
    android:layout_height="wrap_content"
    />
<DatePicker
    android:id="@+id/date"
    android:endYear="2011"
    android:startYear="2011"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />
<Button
    android:id="@+id/submitBtn"
    android:text="Search"
    android:layout_width="@dimen/btn_size"
    android:textSize="@dimen/fnt_size"
    android:layout_height="wrap_content" />
</LinearLayout>

How can I solve this problem?

  • 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-08T01:31:46+00:00Added an answer on June 8, 2026 at 1:31 am

    UPDATE: I have filed bug report for this issue (Android <= 2.3).

    So I was able to reproduce case that you have. Indeed IDEA signals that’s there’s some issue and app is crashing. Using Eclipse will not help (checked it) – Graphical Layout view in there will also signals that it cannot create DatePicker object.

    ROOT CAUSE

    It occurs that the problem in your case is that android:startYear and android:endYear do not include current year on the device (range 2011-2011 does not include 2012 – current year).

    This is probably a bug in DatePicker implementation (prior to API 11) which tries to init the widget with current date regardless whether or not android:startYear and android:endYear define range that have current year within it.

    SOLUTION

    Because you are using API level 9, there are no android:minDate or android:maxDate properties (introduced in API 11). So to restrict date picking to any range of years (workaround for the above mentioned bug), you can implement your own OnDateChangedListener.

    Example code with comments:

    public class MyActivity extends Activity
    {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            DatePicker datePicker = (DatePicker) findViewById(R.id.date);
    
            final int MIN_YEAR = 2011;
            final int MAX_YEAR = 2011;
    
            datePicker.init(MIN_YEAR /* initial year */,
                            01 /* initial month of year */,
                            01 /* initial day of month */,
                    new DatePicker.OnDateChangedListener() {
                        @Override
                        public void onDateChanged(DatePicker datePicker,
                                                  int year,
                                                  int monthOfYear,
                                                  int dayOfMonth) {
    
                            // Override changing year to anything different from outside the range <MIN_YEAR, MAX_YEAR>
                            if (year < MIN_YEAR) {
                                datePicker.updateDate(MIN_YEAR, monthOfYear, dayOfMonth);
                            } else if (year > MAX_YEAR) {
                                datePicker.updateDate(MAX_YEAR, monthOfYear, dayOfMonth);
                            }
                        }
    
                    });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an android mobile application using eclipse. I need a database that
I am developing an Android application using Phonegap . I need to make the
I am developing an Android application using Eclipse and APT. Now I need to
I am developing an android application(using Eclipse 3.5.2, Android 2.2) where i need to
I am developing an android application which gives stock information using YQL. In the
I am currently developing an android application using eclipse and I already have a
I am developing a android mobile application using java. I am trying to use
So im developing a android application and im using a tabhost. To handle the
I'm currently developing an Android application that fetches images using http requests. It would
I'm developing an Android application which sends content to a server using rest web

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.