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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:26:11+00:00 2026-05-30T22:26:11+00:00

In my Android application I use the follow function. But I found out that

  • 0

In my Android application I use the follow function. But I found out that when time is greater than 16777215 (0xFFFFFF) the calculation takes to much time and is incremented every 2 seconds instead of 1.

Is there a way to optimize the code below so it can handle numbers larger than 0xFFFFFF in time?

/**
 * Sets the time wheels to the right time.
 * @param time in seconds
 * @param animation for enableing and disabling animation
 */
private void setTime(float time, boolean animation) {        
    int days;
    int hours;
    int mins;
    int secs;

    days = (int) (time / (3600*24));
    hours = (int)(time / 3600);
    time = time % 3600;
    mins = (int) (time / 60);
    time = time % 60;
    secs = (int) time;

    if(days >= 1){
        getWheel(R.id.time4).setCurrentItem(days, animation);
    } else {
        getWheel(R.id.time4).setCurrentItem(0, animation);
    }

    if(hours >= 1){
        getWheel(R.id.time3).setCurrentItem(hours, animation);
    } else {
        getWheel(R.id.time3).setCurrentItem(0, animation);
    }

    if(mins >= 1){
        getWheel(R.id.time2).setCurrentItem(mins, animation);
    } else {
        getWheel(R.id.time2).setCurrentItem(0, animation);
    }

    if(secs >= 1){
        getWheel(R.id.time1).setCurrentItem(secs, animation);
    } else {
        getWheel(R.id.time1).setCurrentItem(0, animation);
    }
}
  • 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-30T22:26:12+00:00Added an answer on May 30, 2026 at 10:26 pm

    http://developer.android.com/reference/android/text/format/Time.html
    A Time object maybe do the trick?

    You may are exceeding the float datatype, you should use long in this case.

    This http://developer.android.com/reference/java/sql/Time.html#Time%28long%29 constructor is using long.

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

Sidebar

Related Questions

I'm trying to use a blowfish cipher inside an Android application. It appears that
We have an android application that we're trying to use for web-service communication. We
I'm trying to use a custom class (be.myname.rssreader.util.Global) extending android.app.Application, but when I try
I am trying to design my first Android application with the use of GPS.
In a Android application I want to use Scanner class to read a list
I'd like to use the volume buttons for something else in my Android application.
I'm planning to use my website to provide updates for my android application whenever
My Android application uses Java OAuth library, found here for authorization on Twitter. I
I am trying to convert my Android application to use the LoaderManager and CursorLoader.
I would like all the buttons of my android application use the same background

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.