Download in the background - AndEngine GLES2

im porting my project in AndEngine GLES2, with version GLES1 I use this tutorial to load assets in the background, now I get this error:

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

This is my onCreateScene method

  @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; } 
+4
source share
1 answer

Edit

 new AsyncTaskLoader().execute(callback); 

to

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

Source: https://habr.com/ru/post/1397023/


All Articles