Skip to main content
se añadieron 154 caracteres en el cuerpo
Origen Enlace
Juan
  • 1.7k
  • 4
  • 25
  • 39

SOLUCIONADO:

Se agrega un addListener a animator y dentro de el una funcion onAnimationEnd que detecta cuando la animacion termino y al detectarlo muestro el Toast

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash_screen);

    lottieAnimationLogo = findViewById(R.id.lottieAnimationLogo);

    startCheckAnimationLogo();

}

private void startCheckAnimationLogo(){
    ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f).setDuration(3000);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override
    public void onAnimationUpdate(ValueAnimator animation){
 lottieAnimationLogo.setProgress((Float)animation.getAnimatedValue());
    }
});
animator.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
        super.onAnimationEnd(animation);
        Toast.makeText(this, "Text", Toast.LENGTH_SHORT).show();
    }
});
if(lottieAnimationLogo.getProgress() == 0f){
    animator.start();
}else{
    lottieAnimationLogo.setProgress(0f);
  }
}

SOLUCIONADO:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash_screen);

    lottieAnimationLogo = findViewById(R.id.lottieAnimationLogo);

    startCheckAnimationLogo();

}

private void startCheckAnimationLogo(){
    ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f).setDuration(3000);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override
    public void onAnimationUpdate(ValueAnimator animation){
 lottieAnimationLogo.setProgress((Float)animation.getAnimatedValue());
    }
});
animator.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
        super.onAnimationEnd(animation);
        Toast.makeText(this, "Text", Toast.LENGTH_SHORT).show();
    }
});
if(lottieAnimationLogo.getProgress() == 0f){
    animator.start();
}else{
    lottieAnimationLogo.setProgress(0f);
  }
}

SOLUCIONADO:

Se agrega un addListener a animator y dentro de el una funcion onAnimationEnd que detecta cuando la animacion termino y al detectarlo muestro el Toast

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash_screen);

    lottieAnimationLogo = findViewById(R.id.lottieAnimationLogo);

    startCheckAnimationLogo();

}

private void startCheckAnimationLogo(){
    ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f).setDuration(3000);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override
    public void onAnimationUpdate(ValueAnimator animation){
 lottieAnimationLogo.setProgress((Float)animation.getAnimatedValue());
    }
});
animator.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
        super.onAnimationEnd(animation);
        Toast.makeText(this, "Text", Toast.LENGTH_SHORT).show();
    }
});
if(lottieAnimationLogo.getProgress() == 0f){
    animator.start();
}else{
    lottieAnimationLogo.setProgress(0f);
  }
}
Origen Enlace
Juan
  • 1.7k
  • 4
  • 25
  • 39

SOLUCIONADO:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash_screen);

    lottieAnimationLogo = findViewById(R.id.lottieAnimationLogo);

    startCheckAnimationLogo();

}

private void startCheckAnimationLogo(){
    ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f).setDuration(3000);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override
    public void onAnimationUpdate(ValueAnimator animation){
 lottieAnimationLogo.setProgress((Float)animation.getAnimatedValue());
    }
});
animator.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
        super.onAnimationEnd(animation);
        Toast.makeText(this, "Text", Toast.LENGTH_SHORT).show();
    }
});
if(lottieAnimationLogo.getProgress() == 0f){
    animator.start();
}else{
    lottieAnimationLogo.setProgress(0f);
  }
}