Hi guys, I have a ProgressBar and I'm trying to use the setAnimationListener to listen for when the animation ends and etc..
the problem is, it gives me a null pointer exception when I run the code... and I know why NPE's occur.. but with this, it doesn't make much sense.
My code is the following
Can anyone explain why this is throwing a nullpointerexception?
As soon as I delete the setAnimationListener(new AnimationListener etc...)
no errors occur.
It doesn't make sense to me.
the problem is, it gives me a null pointer exception when I run the code... and I know why NPE's occur.. but with this, it doesn't make much sense.
My code is the following
Code:
pb = (ProgressBar)findViewById(R.id.progressBar1);
pb.getAnimation().setAnimationListener(new AnimationListener(){
@Override
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
});
Can anyone explain why this is throwing a nullpointerexception?
As soon as I delete the setAnimationListener(new AnimationListener etc...)
no errors occur.
It doesn't make sense to me.