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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:35:35+00:00 2026-06-03T02:35:35+00:00

How to set previous selected value in TimePicker? I mean, click on TextView, TimePicker

  • 0

How to set previous selected value in TimePicker?

I mean, click on TextView, TimePicker dialog occurs, then I select the time and set it in the TextView, e.g. 12:30 PM on TextView.

After that, if I want to change the time, click again to TextView and then TimePicker dialog should show the previous selected value. So the TimePicker should display 12:30 PM.

How can I do that?

  • 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-03T02:35:36+00:00Added an answer on June 3, 2026 at 2:35 am

    If you create Time Picker Dialog with onCreateDialog and call it it will automatically store the previous value.

    @Override
    protected Dialog onCreateDialog(int id) {
    
    switch (id) {
    
        case 0:
    
    TimePickerDialog timeDlg = new TimePickerDialog(this,
                    new TimePickerDialog.OnTimeSetListener() {
    
                        @Override
                        public void onTimeSet(TimePicker view, int hourOfDay,
                                int minute) {
                            // TODO Auto-generated method stub
    
                            if (hourOfDay > 12) {
                                hourOfDay = hourOfDay - 12;
                                time = " PM";
                            } else if (hourOfDay < 12 && hourOfDay != 0) {
                                time = " AM";
                            } else if (hourOfDay == 12) {
                                time = " PM";
                            } else if (hourOfDay == 0) {
                                hourOfDay = 12;
                                time = " AM";
                            }
    
                            Toast.makeText(
                                    getApplicationContext(),
                                    new StringBuilder().append(pad(hourOfDay))
                                            .append(":").append(pad(minute))
                                            .append(time), Toast.LENGTH_SHORT)
                                    .show();
                        }
                    }, 12, 00, false);
    
            timeDlg.setMessage("Set Time:");
    
            timeDlg.setOnCancelListener(new OnCancelListener() {
    
                @Override
                public void onCancel(DialogInterface dialog) {
                    // TODO Auto-generated method stub
                    Toast.makeText(getApplicationContext(), "Dismiss",
                            Toast.LENGTH_SHORT).show();
                }
            });
            return timeDlg;
    }
        return null;
    }
    

    Use showDialog(id); to Show the Dialog.

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

Sidebar

Related Questions

I have a dijit.form.Select on my page: <c:set var=qualId value=${previous.qualification.id} /> <select id=qualification name=qualification
I want to set a DateTime property to the previous day at time 00:00:00.
I was working with a select box today that a previous employee had written.
Dropdown In my site I have a set of SELECT dropdowns that are set
Our previous webmaster set up this site and the caching he set up works
set dateformat dmy select isdate('31/1/2012') I thought by going into Change the format of
SET @v1 := SELECT COUNT(*) FROM user_rating; SELECT @v1 When I execute this query
I set up the basic Authentication/Authorization set up, but a problem now is that
How can I keep checkboxes selected after the form has been submitted? I found
This is my first time using IB, but after spending a one or two

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.