i have a big problem. i try to implement a kind of speedometer. i get the informations like RPM… every 10-100ms from the car over bluetooth. now i want to rotate the rpm needle to the right position. i do this every time i get data.
ivNadel.startAnimation(RpmAnim);
ivBoost.startAnimation(BoostAnim);
ivLoad.startAnimation(LoadAnim);
the Animations are all implemented like this:
//rotate Tachonadel
Rpmcurrentdegree=Rpmcurrentdegree+Rpmdegree;
Rpmdegree=((rpms-lastrpm)*RPMtoDegree);
if(Rpmdegree!=0)
{
RpmAnim=new RotateAnimation((float)Rpmcurrentdegree, (float)Rpmdegree, ivNadel.getWidth()/2, ivNadel.getHeight()/2);
RpmAnim.setInterpolator(new LinearInterpolator());
RpmAnim.setFillEnabled(true);
RpmAnim.setFillAfter(true);
}
the problem is that the startAnimations slow down the reaction time of the ui by about half a second. when i comment the 3 startAnimation out it works fine again.
so does anyone know a way how to work around this slow down?
i also tried to start the animation only if there was a change on the degrees but then the ImageView does not hold its new position after the rotateanimation.
plz help
I can’t answer your question directly but this link may help
http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/
It uses a custom UI component drawn and rotates a needle with a canvas rather than animations.