Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid cocos2d adding child node throws nullpointer exception
    text
    copied!<p>I am very much new to cocos2d.. I am developing an application in android using cocos2d.. In that,</p> <pre><code>public class BaseLayer extends CCLayer { ChildLayer cl = new ChildLayer(); this.addChild(cl); ------------------------------&gt; } public class ChildLayer extends CCLayer { public ChildLayer() { CCLayer.node(); } . . } </code></pre> <p>In this, arrowed line throws the Null pointer exception.. Error Log is below..</p> <pre><code>E/AndroidRuntime(982): FATAL EXCEPTION: GLThread 8 11-26 12:50:33.364: E/AndroidRuntime(982): java.lang.NullPointerException 11-26 12:50:33.364: E/AndroidRuntime(982): at org.cocos2d.nodes.CCSprite.draw(CCSprite.java:871) 11-26 12:50:33.364: E/AndroidRuntime(982): at org.cocos2d.nodes.CCNode.visit(CCNode.java:674) 11-26 12:50:33.364: E/AndroidRuntime(982): at org.cocos2d.nodes.CCNode.visit(CCNode.java:680) 11-26 12:50:33.364: E/AndroidRuntime(982): at org.cocos2d.nodes.CCNode.visit(CCNode.java:680) 11-26 12:50:33.364: E/AndroidRuntime(982): at org.cocos2d.nodes.CCNode.visit(CCNode.java:680) 11-26 12:50:33.364: E/AndroidRuntime(982): at org.cocos2d.nodes.CCDirector.drawCCScene(CCDirector.java:683) 11-26 12:50:33.364: E/AndroidRuntime(982): at org.cocos2d.nodes.CCDirector.onDrawFrame(CCDirector.java:651) 11-26 12:50:33.364: E/AndroidRuntime(982): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1332) 11-26 12:50:33.364: E/AndroidRuntime(982): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116) 11-26 12:50:34.023: E/libEGL(982): call to OpenGL ES API with no current context (logged once per thread) </code></pre> <p>I dont know how to resolve this issue.. I dont know why this occurs.. Since I am not much familiar with Cocos2d.. Please help me to resolve this issue. Somebody please help me..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload