Lottie - toggle switch

Asked

Viewed 34 times

2

I’m trying to set up a toggle switch in android studio using Lottie documentation. I got it, but this making 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;
            }
        }
    });
  • 2

    Be more specific, what is the error generated?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.