[SOLVED] Android java.lang.NullPointerException at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2922)

If you are getting this in your Android code:

[code]
java.lang.NullPointerException at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2922)
[/code]

The reason for this could be that you are trying to do some view changes upon animationEnd. This is not allowed so you need to use this trick:

[code]
@Override
public void onAnimationEnd(Animation animation) {
new Handler().post(new Runnable() {
public void run() {
myLayout.removeView(simulateMovingImg);
}
});
}
[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *