0

I have a textField and a button, both of them initially invisible. The textField fades in after the user does some stuff (this part works fine). What I want is for the button to fade in AFTER the text field has faded in. Below is the code that I came up with:

    View textMessage = findViewById(R.id.pinTextMessage);
    textMessage.startAnimation(fadeinText);
    textMessage.setVisibility(View.VISIBLE);

    fadeinText.setAnimationListener(new Animation.AnimationListener() {
        public void onAnimationStart(Animation animation) {}

        public void onAnimationEnd(Animation animation) {
            View nextButton = findViewById(R.id.pinButton);
            nextButton.startAnimation(fadeinButton);
            nextButton.setVisibility(View.VISIBLE);
        }

        public void onAnimationRepeat(Animation animation) {}
    });

The app runs fine until the first animation ends, then crashes. Are there any glaringly obvious mistakes?

4

0 回答 0