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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:53:08+00:00 2026-06-09T09:53:08+00:00

Hi all, I have written an application where I have a speedometer with a

  • 0

speedometer

Hi all,

I have written an application where I have a speedometer with a needle vertically set at 90 degree and I am trying to rotate the needle around its center with the speed that changes for every one second(I am displaying the speed in a text view that changes randomly from 0 to 120)

I am getting the speed from a remote service and displaying in a textview.

so as the speed changes the speedometer needle gauge should change accordingly around its center. I mean If speed is 30 the needle should be at 30 and so on in speedometer.

My code is not working exactly, How to get around this problem?

Help is always appreciated,Thanks.

Here is my code:

pointer1 = (ImageView) findViewById(R.id.pointer1);

double degrees= speed;
double angle = degrees * 2 * Math.PI / 360.0;

for( speed=0;speed<120;speed++){
    RotateAnimation rAnimAntiClockWise = new RotateAnimation(180-0.0f, 180-speed,
        Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);

    rAnimAntiClockWise.setInterpolator(new LinearInterpolator());
    rAnimAntiClockWise.setDuration(100);
    rAnimAntiClockWise.setFillAfter(true);
    rAnimAntiClockWise.setDuration(10000);
    rAnimAntiClockWise.setRepeatCount(-1);
    rAnimAntiClockWise.setRepeatMode(2);
    pointer1.startAnimation(rAnimAntiClockWise); 
}

private void invokeService() {
    if (conn == null) {

    } else {
        try {
        System.out.println(remoteService);

        int speed = remoteService.getSpeed();

        System.out.println("myspeed" + speed);

        TextView r = (TextView) findViewById(R.id.text2);
        r.setText("" + Integer.toString(speed));
            Log.d(getClass().getSimpleName(), "invokeService()");

        } catch (RemoteException re) {
        Log.e(getClass().getSimpleName(), "RemoteException");
        }
    }
}
  • 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-09T09:53:10+00:00Added an answer on June 9, 2026 at 9:53 am

    Try this code:

    currentDegree=60;
    speedDisplayTxt.addTextChangedListener(new TextWatcher()
        {
    
            public void onTextChanged(CharSequence arg0, int arg1, int arg2,
                    int arg3) {
                fromDegrees= currentDegree;
                String speed=txt.getText().toString();
                toDegree= //convert speed to angle here.
                RotateAnimation NeedleDeflection = new RotateAnimation(fromDegrees, toDegrees, ...){
                protected void applyTransformation(float interpolatedTime,Transformation t) {
                    float currentDegree = fromDegrees+(toDegrees-fromDegrees)*interpolatedTime;
                    super.applyTransformation(interpolatedTime, t);
                    };
                NeedleDeflection.setDuration(duration); 
                NeedleDeflection.setFillAfter(true);
                needle.startAnimation(NeedleDeflection);
    
                      }
                 }          
    
        }
    
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an application written in both C++ and .NET that installs for all
I have written an application in C# that generates all the words that can
Good day all, I have written an application that i require to have a
I have recently written a survey application that has done it's job and all
This is odd, but we have written an asp.Net web application (all's well there)
All, I have written a PhoneBook application in Java that is command line based.
I have written all the code for an application in C++. It is standard
I have an application written in java that needs to find all the reachable
I have all the tests for my web application (written with the Visual Studio
Hi guys so I have written my play application and all is working fine.

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.