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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:16:31+00:00 2026-05-29T10:16:31+00:00

So I am trying to get a SeekBar to function like a gas pedal.

  • 0

So I am trying to get a SeekBar to function like a gas pedal.

When it is at the neutral postion (progress = 50) then my value does not change. When the SeekBar progress becomes greater than or less than 50, I take that difference from 50 and use it to calculate a value that gets pushed to a TextView.

This addition or subtraction to the value does not occur because the progress has changed but instead based on how long it is held at that point of progress. THis means that the farther from 50 you are, the faster the value goes up, or in the other direction, down.

My first thought was a Thread that had a while loop that slept and then updated the value. I stored the progress of the SeekBar globally. This worked for calculating my value, but because it doesn’t run on the UI thread I can’t update the UI from it.

How could I make this “Gas Pedal” SeekBar work?

  • 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-29T10:16:32+00:00Added an answer on May 29, 2026 at 10:16 am

    This could all run in the UI thread. Use postDelayed to run a Handler to update your “speedometer” once in a while (requesting 250 ms seems OK). However often your Handler actually runs, you’ll use actual time elapsed, not the requested interval, to calculate your speedometer update. (You have to do that in any physics simulation because the real world keeps running no matter how often or how irregularly your update functions get called.)

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

Sidebar

Related Questions

Trying to get my css / C# functions to look like this: body {
Trying to get an ASP application deployed; it worked for a while but then
I am trying get content from the link https://....com:8455 where Server's certificate is not
I am trying get the html within .event_recur. $(.entry).each(function(){ alert($(this).find(.event_recur).html()); }); <div class=entry> <p
Trying to get a value from a object isn't working out. class Asset <
I'm trying get value of var by its name: var1='Hello' var2 = getTextFromFirstTextBox() //text
I am trying get date of call but it's returning value of 1.1.1970(I think
I'm trying get to know decorators, and I have a problem with sharing value,
I'm new to Drupal and trying get my head around it. I'd like to
I am trying get the data from my database but i am not getting

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.