public class MainActivity extends AppCompatActivity { ActivityMainBinding binding;
View pointer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding=ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
startAnimationCounter(0,50);
View decorView = getWindow().getDecorView();
float speedRotation = -120.5f ;
pointer = findViewById(R.id.pointer);
pointer.setRotation(speedRotation);
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
public void startAnimationCounter(int start_no,int end_no){
ValueAnimator animator=ValueAnimator.ofInt(start_no,end_no);
animator.setDuration(10000);
animator.addUpdateListener(animation -> {
binding.speed.setText(animation.getAnimatedValue().toString());
binding.centerCircle.setProgress(Integer.parseInt(animation.getAnimatedValue().toString()));
});
animator.start();
}@Override
protected void onDestroy() {
super.onDestroy();
binding=null;
}
}