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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:28:56+00:00 2026-06-03T08:28:56+00:00

I am new, i apologize, i had searched but could not find an answer

  • 0

I am new, i apologize, i had searched but could not find an answer in previous questions.
I have a date picker and a time picker yet when i run it, the time picker dialog does not show. Any idea? I searched for an answer for hours, this is the code i have:

    public class BuildingFireActivity extends Activity {

private Button buildingfirePickDate;
private Button buildingfiredispatchPickTime;

private TextView buildingfireDateDisplay;
private TextView buildingfiredispatchTimeDisplay;

private int buildingfireYear;
private int buildingfireMonth;
private int buildingfireDay;
private int buildingfiredispatchHour;
private int buildingfiredispatchMinute;

static final int DATE_DIALOG_ID = 0;
static final int TIME_DIALOG_ID = 1;


public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.buildingfirelayout);

    buildingfirePickDate = (Button) findViewById(R.id.pickDate);
    buildingfiredispatchPickTime = (Button) findViewById(R.id.dispatchTime);

    buildingfireDateDisplay = (TextView) findViewById(R.id.dateDisplay);
    buildingfiredispatchTimeDisplay = (TextView) findViewById(R.id.dispatchDisplay);

    buildingfirePickDate.setOnClickListener(new View.OnClickListener() {


@SuppressWarnings("deprecation")
public void onClick(View v) {
    showDialog(DATE_DIALOG_ID);}});
    final Calendar c = Calendar.getInstance();
    buildingfireYear = c.get(Calendar.YEAR);
    buildingfireMonth = c.get(Calendar.MONTH);
    buildingfireDay = c.get(Calendar.DAY_OF_MONTH);
    updateDisplay();
    buildingfiredispatchPickTime.setOnClickListener(new View.OnClickListener() {
@SuppressWarnings("deprecation")
public void onClick(View v) {
    showDialog(TIME_DIALOG_ID);}});
    final Calendar dispatch = Calendar.getInstance();
    buildingfiredispatchHour = dispatch.get(Calendar.HOUR_OF_DAY);
    buildingfiredispatchMinute = dispatch.get(Calendar.MINUTE);
    updateDisplay1();}
private static String pad(int dispatch) {
    if (dispatch >= 10)
    return String.valueOf(dispatch);
    else
    return "0" + String.valueOf(dispatch);}


private void updateDisplay() {
    buildingfireDateDisplay.setText(
    new StringBuilder()
    .append(buildingfireMonth + 1).append("-")
    .append(buildingfireDay).append("-")
    .append(buildingfireYear).append(" "));}
private void updateDisplay1() {
    buildingfiredispatchTimeDisplay.setText(
    new StringBuilder()
    .append(pad(buildingfiredispatchHour)).append(":")
    .append(pad(buildingfiredispatchMinute)));}

private DatePickerDialog.OnDateSetListener buildingfireDateSetListener =
    new DatePickerDialog.OnDateSetListener() {
    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            buildingfireYear = year;
            buildingfireMonth = monthOfYear;
            buildingfireDay = dayOfMonth;
            updateDisplay();}};
private TimePickerDialog.OnTimeSetListener buildingfiredispatchTimeSetListener =
    new TimePickerDialog.OnTimeSetListener() {
    public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
            buildingfiredispatchHour = hourOfDay;
            buildingfiredispatchMinute = minute;
            updateDisplay1();}}; 



protected Dialog onCreateDialog(int id) {
    switch (id) {
    case TIME_DIALOG_ID:
    return new TimePickerDialog(this,
            buildingfiredispatchTimeSetListener, 
            buildingfiredispatchHour, 
            buildingfiredispatchMinute, false);}
            return null;}

@Override
protected Dialog onCreateDialog1(int id) {
    switch (id) {
    case DATE_DIALOG_ID:
    return new DatePickerDialog(this,
            buildingfireDateSetListener,
            buildingfireYear, 
            buildingfireMonth, 
            buildingfireDay);}
            return null;}}
  • 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-03T08:28:57+00:00Added an answer on June 3, 2026 at 8:28 am
    protected Dialog onCreateDialog(int id) {
        switch (id) {
        case TIME_DIALOG_ID:
        return new TimePickerDialog(this,
            buildingfiredispatchTimeSetListener, 
            buildingfiredispatchHour, 
            buildingfiredispatchMinute, false);
        case DATE_DIALOG_ID:
        return new DatePickerDialog(this,
            buildingfireDateSetListener,
            buildingfireYear, 
            buildingfireMonth, 
            buildingfireDay);
        }
        return null;
    }
    

    Try to use this code and remove the onCreateDialog1().

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

Sidebar

Related Questions

I'm new to PHP so I apologize if this seems silly. I've searched around
I'm new to Haskell so I apologize if this is an easy question, but
I'm not sure really what to search for to try and find my answer,
I am new to iOS dev and apologies if the answer is obvious...but it
I tried to find a similar question on SO but had no luck. Apologies
I apologize if I'm not super clear with my explanation but I'll add to
Extreme newbie, apologize in advance, I have no idea what I'm doing -- but
I'm new and apologize upfront. I've searched for sample code and tutorials on the
I apologize for being new with backbone but I think I get the concepts.
I am new to Ext so I apologize in advance if my question is

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.