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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:16:42+00:00 2026-05-20T03:16:42+00:00

When I try to add a DatePicker to my layout, whenever the activity is

  • 0

When I try to add a DatePicker to my layout, whenever the activity is launched, it crashes with a stack overflow.

This is the layout that crashes when displayed on the emulator (renders fine in eclipse):

        </LinearLayout>
        <TableLayout android:layout_width="fill_parent"
            android:layout_height="fill_parent" android:stretchColumns="1"
            android:layout_below="@+id/topLayout" android:paddingBottom="5dip"
            android:layout_marginBottom="50dip">
            <TableRow android:layout_weight="1">
                <LinearLayout android:layout_width="fill_parent"
                    android:layout_height="fill_parent" android:layout_weight="1">
                    <TextView android:layout_width="wrap_content"
                        android:text="Date:" android:layout_height="fill_parent"
                        android:gravity="center_vertical"></TextView>
                </LinearLayout>
            </TableRow>
            <TableRow android:layout_weight="1">
                <LinearLayout android:layout_width="fill_parent"
                    android:layout_height="fill_parent" android:layout_weight="1">
                    <DatePicker android:layout_height="wrap_content"
                        android:layout_width="fill_parent" android:id="@+id/datePicker" android:duplicateParentState="true"></DatePicker>
                </LinearLayout>
            </TableRow>
        </TableLayout>
    </RelativeLayout>


    <LinearLayout android:gravity="bottom|right"
        android:layout_height="wrap_content" android:layout_width="fill_parent"
        android:layout_below="@+id/RelativeLayout01">
        <Button android:layout_width="wrap_content" android:gravity="center"
            android:layout_gravity="left" android:layout_height="fill_parent"
            android:id="@+id/btnCancel" android:layout_weight="1" android:text="Cancel" />
        <Button android:layout_width="wrap_content"
            android:layout_gravity="right" android:gravity="center"
            android:layout_weight="1" android:layout_height="fill_parent"
            android:id="@+id/btnFinish" android:text="Finish" />
    </LinearLayout>
</RelativeLayout>

And it crashes with this stack trace:

Thread [<3> main] (Suspended (exception StackOverflowError))    
    ViewRoot.draw(boolean) line: 1235   
    ViewRoot.performTraversals() line: 1030 
    ViewRoot.handleMessage(Message) line: 1482  
    ViewRoot(Handler).dispatchMessage(Message) line: 99 
    Looper.loop() line: 123 
    ActivityThread.main(String[]) line: 3948    
    Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
    Method.invoke(Object, Object...) line: 521  
    ZygoteInit$MethodAndArgsCaller.run() line: 782  
    ZygoteInit.main(String[]) line: 540 
    NativeStart.main(String[]) line: not available [native method]  

When I comment out the DatePicker, it doesn’t crash.

How can I actually get the DatePicker to not crash this app?

  • 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-20T03:16:42+00:00Added an answer on May 20, 2026 at 3:16 am

    Start by getting rid of the superfluous LinearLayout parent of the DatePicker.

    If that helps, or if the stack trace for your exception appeared to be in Android layout rendering code (e.g., calls to layout() and onMeasure() and such), you probably have too complex of a UI. Use Hierarchy Viewer to examine your activity — if the longest path from the root container to the farthest leaf is much over 10, your UI is too complex. Simplify the user interface (e.g., switch from nested LinearLayouts to RelativeLayout, replace activities-in-tabs with views-in-tabs).

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

Sidebar

Related Questions

My IDE crashes any time I try add a new component to the toolbar.
Whenever I try to add a new project to my SourceSafe repository it creates
When I launch perfmon and try to add a counter, the displayed performance objects
So, I know that try/catch does add some overhead and therefore isn't a good
i try to add ZipArchive folder that contain source code, then drag and drop
I try to add client side validation using this line of code: @Html.EnableClientValidation() But
I have an example web solution that I downloaded and when I try Add
I try to add an addons system to my Windows.Net application using Reflection; but
My project is based on spring framework 2.5.4. And I try to add aspects
I have a DataGrid with 5 template columns, However when I try and add

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.