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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:31:39+00:00 2026-05-31T07:31:39+00:00

im working on auto profile changer application for android…this is my 2nd application im

  • 0

im working on auto profile changer application for android…this is my 2nd application im developing on android, so dont know all the bells and whistles of android development…

any way…i am having some trouble calculating the next time when the timer code is suppose to execute…mainly the issue is around the time that spans over midnight into the next day…

for example, say that the user created a sleeping profile that starts at 10:30PM and goes until 8AM the next day…using this as a example, the execution is getting inside the proper condition that i have placed in the code, but the nextUpdateInterval is not being set correctly…im still trying to figure out how to account/calculate time that spans over to the next day, and at this point im starting to think that im might be making this task overly complicated? any suggestions?

here is the snippet of the code:

    timer.scheduleAtFixedRate( new TimerTask() {
public void run() {
    //..... some code to convert user stored times into proper time formats
    //PM to PM
    if(isFromTimePM == true && isToTimePM == true){

    }//PM to AM
    else if(isFromTimePM == true && isToTimePM == false){
        if(rightNowDate.getTime() >= fromDate.getTime() && rightNowDate.getTime() >= toDate.getTime()){
            foundProfileIndex = i;
                i = profileArrayListSize;


            nextUpdateInterval = rightNowDate.getTime() - toDate.getTime();
        }                   
    }//AM to AM
    else if(isFromTimePM == false && isToTimePM == false){

    }//AM to PM
    else if(isFromTimePM == false && isToTimePM == true){

    }}, 0, nextUpdateInterval);

Thanks,
P

  • 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-31T07:31:40+00:00Added an answer on May 31, 2026 at 7:31 am

    none of this secondDate – firstDate was ever necessary, what i ended up doing was the following:

    1. converted all times to miliseconds
    2. converted the milliseconds into the date objects
    3. used the compareTo to compare the ‘to’ ‘from’ dates to current date/time
    4. if i found a profile match, then i stored the ‘to’ date as the next run date
    5. created a reScheduleTimer method that took date as a paramter…and i just used the .schdule(timertask, date) to resechule the timer…
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on some application which has auto-update function. The implemented idea is simple
I am working on auto complete and used this http://jqueryui.com/demos/autocomplete/#combobox Now my query is
I m working on an auto start application. In my application when app starts
I am working on one application which basically is an auto-start application and runs
I'm trying to get auto-complete working with a simple application that I'm building. Here
i am working with a jquery Auto suggestion search programm. anyone know jQuery auto
I have auto complete for a JCombobox working by following this article: http://today.java.net/pub/a/today/2007/07/19/adding-auto-completion-to-swing-comboboxes.html I
I am working on auto vectorization with GCC. I am not in a position
i was working ajax auto completeextender witha text box in asp.net and c#.net. i
im trying to getting auto complete working and i can do so fine when

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.