2012-02-17 82 views
4

IM移植我在AndEngine GLES2項目,GLES1 versione我用這個tutorial加載資產的背景下,現在我收到此錯誤:加載在背景 - AndEngine GLES2

mActivity.onCreateScene failed. @(Thread: 'GLThread 10') 
java.lang.ExceptionInInitializerError 

這是我onCreateScene方法

@Override 
    public Scene onCreateScene() { 
     this.mEngine.registerUpdateHandler(new FPSLogger()); 
     SplashScene mSplashScene = new SplashScene(this); 

     IAsyncCallback callback = new IAsyncCallback() { 

      @Override 
      public void workToDo() { 
      //Do something} 

      @Override 
      public void onComplete() { 
       LoadingScene mLoadingScene = new LoadingScene(mActivity.this); 
       mActivity.this.getEngine().setScene(mLoadingScene); 
      } 
     }; 

     new AsyncTaskLoader().execute(callback); 

     return mSplashScene; 
    } 
+0

有人能幫幫我嗎? – Erick 2012-02-17 17:16:44

回答

5

變化

new AsyncTaskLoader().execute(callback); 

//Fixed variant working with gles1 and gles2 
    runOnUiThread(new Runnable() { 
     @Override 
     public void run() { 
      new AsyncTaskLoader().execute(callback); 
     } 
    }); 
+0

嗨最近我發現,ICS不支持Runnable在正常的Android應用程序做上面的代碼使問題,當我們在andengine中使用此... – 2012-12-11 17:53:52