0

I'm developing a game in which I am trying to move from 1st stage to 2nd stage. When I start the 2nd stage directly it runs perfectly, but when I play the 1st stage and unlock the 2nd stage, and then start the second stage then it shows an error:

02-25 14:07:09.923: ERROR/AndroidRuntime(409): FATAL EXCEPTION: GLThread 12
02-25 14:07:09.923: ERROR/AndroidRuntime(409): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
02-25 14:07:09.923: ERROR/AndroidRuntime(409):     at android.graphics.Bitmap.nativeCreate(Native Method)
02-25 14:07:09.923: ERROR/AndroidRuntime(409):     at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
02-25 14:07:09.923: ERROR/AndroidRuntime(409):     at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
02-25 14:07:09.923: ERROR/AndroidRuntime(409):     at com.threed.jpct.util.BitmapHelper.rescale(BitmapHelper.java:72)
02-25 14:07:09.923: ERROR/AndroidRuntime(409):     at bones.samples.android.LevelTwo$MyRenderer.onSurfaceChanged(LevelTwo.java:555)
02-25 14:07:09.923: ERROR/AndroidRuntime(409):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1356)
02-25 14:07:09.923: ERROR/AndroidRuntime(409):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

I can't understand this situation because when I only run a single stage then they run correctly but when run 2nd after first it can't.

Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.d‌​rawable.bgtwo)), 512, 1024));
TextureManager.getInstance().addTexture("texture", texture);
Chris Emerson
  • 13,041
  • 3
  • 44
  • 66

0 Answers0