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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:33:33+00:00 2026-06-14T09:33:33+00:00

I am making a custom ProgressBar which has a bitmap that just rotates. if

  • 0

I am making a custom ProgressBar which has a bitmap that just rotates. if I use the View.invalidate the FPS will stutter; the deltaTime will go up 40+ many times. The logic and render is almost instantaneous but the invalidate call makes it slow. So I am trying the SurfaceView, problem is I have had problems earlier assemble SurfaceViews with other Views and I would like not to use it. Are there any alternative to SurfaceView and View.invalidate or am I stuck with them?

EDIT:

To clarify some more, I am making a custom View that is an intermediate ProgressBar. So the View is the ProgressBar. I am also not downloading anything now, I am only trying to get max FPS for my View. Some code:

MyProgressBar extends View implements Runnable

And the run()

calculateNewRotation();
invalidate();
post(this);

Where calculateNewRotation()

long now = SystemClock.uptimeMillis();
int deltaTime = (int) (now - mLastRender);
mLastRender = now;
mSpinRotation += deltaTime * SPIN_SPEED_PER_MILLISECOND_CLOCKWISE;

Post(this) refer to MyProgressBar and it will loop for all eternity until I say otherwise.

In my onDraw()

mCamera.save();
mCamera.rotateZ(mSpinRotation);
mCamera.getMatrix(mMatrix);
mCamera.restore();

mMatrix.preTranslate(-mTranslatePivotX, -mTranslatePivotY);
mMatrix.postTranslate(mTranslatePivotX + mCenterX, mTranslatePivotY + mCenterY);

canvas.drawBitmap(mSpinBitmap, mMatrix, mSpinBitmapPaint);

Time for calculateNewRotation() = 1 ms.

Time for onDraw() = 1 ms.

Problem is the overall time is often above 40 ms. My solution is to then use a SurfaceView, but I do not like the idea to have a View with it’s surface drawn with transparent pixels so the underlying surface will be shown instead. What I am looking for is a View that I may get the canvas whenever I want, preferably every 16 ms to get 60 FPS. Now, is there such a View?

  • 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-14T09:33:34+00:00Added an answer on June 14, 2026 at 9:33 am

    What I did in the end was when I have drawn the image I update the rotation value by 1. On fast and slow phones it will look smooth, but the speed will be different. On a fast phone it might draw 60 frames per second which is 60 degrees a second, when a slow phone with 10 frames per second will make the spin go 10 degrees a second. So in the end it is all about if I want them to rotate at the same speed or make it look good, I choose the latter one.

    EDIT

    I suppose I could put in a max frames per second so fast phones will be throttled and thus making the gap between fast and small phones smaller.

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

Sidebar

Related Questions

I am making a custom form object in Django which has an overrided __init__
I'm making a custom control that's an expandable/collapsable panel, which I can then fill
I am making a custom ImageButton Control which has the option to show button
I'm making a custom view that I want to be bindings/core data compatible and
I'm making a custom search to a DB that has 6 different columns. To
I'm making a custom component that shows a little drop down area after you
I'm making a custom webcam user control. I use Microsoft Expression Encoder, and set
I'm making a custom control that can be dragged around and it is semi
I am making custom NSScrollers for use in NSScrollView. But when any of the
I'm making a custom video field that is supposed to accept several files (for

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.