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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:25:40+00:00 2026-05-24T09:25:40+00:00

I am working on a live wallpaper, so no worries about physics collisions. I

  • 0

I am working on a live wallpaper, so no worries about physics collisions. I just want to have as smooth a frame rate as possible, up to a limit of 30fps to conserve battery.

To do this, at the end of the loop, and I measure time since the beginning of that loop. If the frame took less than 33ms, I use Thread.sleep() to sleep the number of ms to get up to 33.

However, I know that Thread.sleep() is not super accurate, and is likely to sleep longer than I ask for. I don’t know by how much.

Is there a different method I can use that will provide a more even rate?

  • 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-24T09:25:41+00:00Added an answer on May 24, 2026 at 9:25 am

    Yes, Thread.sleep() is not super-accurate.

    You can try to use adaptive strategy — do not just sleep(remaining), but have a variable long lastDelay, and, each time you observe too high frame rate you increase it, and Thread.sleep(lastDelay), each time you observe too low frame rate — you decrease it. So after second or about your code find right number…

    By the way, the Thread.sleep is not the best way to limit frame rate. Using of Timer is more promising — but you’ll have same problem, since Timer accuracy is likely the same, as Thread.sleep()

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

Sidebar

Related Questions

I'm working on an Android live wallpaper. I have everything working just fine so
I have been working on creating a live wallpaper lately by placing a bitmap
I'm working on a simple android live wallpaper, I'm following chapter 12 from Hello,
I have the .live aspect working now so if links are clicked, my function
I have some Ajax that has been working on a live site, now it
Is it possible somehow to set Live Wallpaper programmatically using my Application? I am
I'm working on a live wallpaper. The wallpaper requires small movable images to be
I have a Live Wallpaper that uses various screen touches to trigger certain events.
Hi I have been trying to get this script http://jsbin.com/ipajo5/ working but using .live()
Has anyone managed to get OpenGL ES 2.0 working in a live wallpaper? I

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.