I'm trying to set up a toggle switch in the android studio using the lottie documentation. I have, but this is giving a mistake, I need a little help guys.
final boolean[] oontrole = {false};
final LottieAnimationView animationView = (LottieAnimationView) findViewById(R.id.animation_view);
animationView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(oontrole[0]) {
animationView.setAnimation("androidDesliga.json");//animação botao desligando
animationView.playAnimation();
oontrole[0] = false;
} else {
animationView.setAnimation("androidLiga.json");//animação botao ligando
animationView.playAnimation();
oontrole[0] = true;
}
}
});