开发一款安卓小游戏(支持2.1到4.2),下面的代码经常会抛出java.lang.NullPointerException异常
canvas.drawColor((0xFFAAAAAA);
public class MainGamePanel extends SurfaceView implements SurfaceHolder.Callback {
public void render(Canvas canvas) {
canvas.drawColor(0xFFAAAAAA);
droid.draw(canvas);
}
}
这是堆栈跟踪
java.lang.NullPointerException
at com.rdx.play.MainGamePanel.render(MainGamePanel.java:186)
at com.rdx.play.MainThread.run(MainThread.java:54)
异常不一致,什么可能导致此问题?
非常感谢。