android - AndEngine: java.lang.NullPointerException in onCreateResources() -
i got error when creating background in game. if use same code in project, works great. can't understand. here code:
public class play extends simplebasegameactivity {  bitmaptextureatlas bg_bta; textureregion bg_tr;  @override public engineoptions oncreateengineoptions() {     this.mcamera = new camera(0, 0, config.screenwidth, config.screenhieght);     engineoptions option = new engineoptions(true,             config.screenorientation_default, new ratioresolutionpolicy(                     config.screenwidth, config.screenhieght), this.mcamera);     option.getaudiooptions().setneedsmusic(true);     option.getaudiooptions().setneedssound(true);     return option; }  @override protected void oncreateresources() {     // todo auto-generated method stub     this.bg_bta = new bitmaptextureatlas(mengine.gettexturemanager(),1024, 1024, textureoptions.bilinear_premultiplyalpha);     this.bg_tr = bitmaptextureatlastextureregionfactory.createfromasset(this.bg_bta, this.getassets(), "bg/bg/bg0.png", 0, 0);     this.bg_bta.load(); }  @override protected scene oncreatescene() {     // todo auto-generated method stub     mscene = new scene();     mscene.settouchareabindingonactiondownenabled(true);     mscene.settouchareabindingonactionmoveenabled(true);      sprite mbackground = new sprite(0, 0,             config.screenwidth, config.screenhieght, this.bg_tr, mengine.getvertexbufferobjectmanager());     this.mscene.attachchild(mbackground);     return mscene; }   - , logcat:
05-17 22:12:13.521: e/andengine(1432): play.oncreategame failed. @(thread: 'glthread 136') 05-17 22:12:13.521: e/andengine(1432): java.lang.nullpointerexception 05-17 22:12:13.521: e/andengine(1432):  @ com.binnana.taptaplinklink.play.oncreateresources(play.java:153) 05-17 22:12:13.521: e/andengine(1432):  @ org.andengine.ui.activity.simplebasegameactivity.oncreateresources(simplebasegameactivity.java:41) 05-17 22:12:13.521: e/andengine(1432):  @ org.andengine.ui.activity.basegameactivity.oncreategame(basegameactivity.java:181) 05-17 22:12:13.521: e/andengine(1432):  @ org.andengine.ui.activity.basegameactivity.onsurfacecreated(basegameactivity.java:110) 05-17 22:12:13.521: e/andengine(1432):  @ org.andengine.opengl.view.enginerenderer.onsurfacecreated(enginerenderer.java:80) 05-17 22:12:13.521: e/andengine(1432):  @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1494) 05-17 22:12:13.521: e/andengine(1432):  @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1240)   error @ line this.bg_bta = new bitmaptextureatlas(mengine.gettexturemanager(),1024, 1024, textureoptions.bilinear_premultiplyalpha);
thank help!
 
 
  
Comments
Post a Comment