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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:40:34+00:00 2026-06-17T05:40:34+00:00

I want to create a dialog which can select the time and the date

  • 0

I want to create a dialog which can select the time and the date at the same time.
I know that there is not a default widget that can do that on Android. I also know that there are open source projects on how do similar staff. The problem in this project is that in the dialog we have two buttons: datePicker and timePicker.

enter image description here

And that’s not what I want to do – I want that the date and time picker appear at the same time.
So I think the two main problem will be:

  1. First make the time and date picker appear in the same dialog.
  2. And the second problem will be to change the appearance of time and date picker (the orange color).

The first problem was resolved by Bhavesh. Here is what I get:

enter image description here

The problem now is that I want to change all blue bar color to orange color.
I added android:calendarViewShown="false" to remove the calendar in the right 🙂 Thanks Bhavesh and I changed the theme to HOLO
Here is what I get:

enter image description here

You can download the code (that’s the best I can do). You can download from here.

  • 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-17T05:40:35+00:00Added an answer on June 17, 2026 at 5:40 am

    First make the time and date picker appear in the same dialog

    Here i can help you some what: you can create a layout consisting of a DatePicker and a TimePicker in a LinearLayout with the orientation set to vertical.

    custom_dialog.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    
        <DatePicker
             android:id="@+id/datePicker1"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content" >
        </DatePicker>
    
        <TimePicker
            android:id="@+id/timePicker1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TimePicker>
    
    </LinearLayout>
    

    Then use this layout to create your dialog.

    Dialog dialog = new Dialog(mContext);
    
    dialog.setContentView(R.layout.custom_dialog);
    dialog.setTitle("Custom Dialog");
    

    To react to the user interacting with your TimePicker, do something like this:

    TimePicker tp = (TimePicker)dialog.findViewById(R.id.timepicker1);
    tp.setOnTimeChangedListener(myOnTimechangedListener);
    

    To get the values from the Date- and TimePicker when the user has finished setting them, add an OK button in your dialog, and then read the date and time values from the Date- and TimePicker when the user presses OK.

    To make something that looks exactly as in your screen shots I recommend you to make all things custom with your own logic.

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

Sidebar

Related Questions

Hello All I want to create a dialog from which I can set date
I have an action which create QMessageBox. In that dialog I want to print
I want to create Dialog box which can show form where i can refresh
I want to create a dialog which appears when user presses a button. (In
In my application I want to create a dialog which has a button to
I want to create a dialog that contains some kind of text element (JLabel/JTextArea
I want to create a modal dialog that has more controls than what a
I do not want to use the graphics resources to create the dialog! What
I want to know how to publish from PowerShell the same way I can
I'm really interested if I can create two dialogs in Android in same time

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.