我有这段代码可以用图像创建淡入淡出的动画
push_top_in 代码创建一个从上到下的淡入淡出动画
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="-100%p" android:toYDelta="0" android:duration="1000"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="1000" />
</set>
JAVA代码调用push_top_in动画
ImageView imvLogo = (ImageView) findViewById(R.id.imvLogo);
Animation myFadeInAnimation = AnimationUtils.loadAnimation(MisCompras.this, R.animator.push_top_in);
imvLogo.startAnimation(myFadeInAnimation);
现在我想在动画结束时显示一个进度条,我使用这段代码
myFadeInAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
progressBarCust = (ProgressBar)findViewById(R.id.progressBar);
textViewLoad = (TextView)findViewById(R.id.txvProgreso);
Handler hdl = new Handler();
hdl.postDelayed(new MiSuperHandler(), 5000);
}
});
但是 setAnimationListener 代码抛出了下一个异常
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{miscompras.principal/miscompras.principal.MyActivity}: java.lang.NullPointerException
我不知道出了什么问题
请帮忙