title: GLSurfaceView EGL_BAD_ALLOC
body: <p>My program switches between two <code>Activities</code> that each inflate a derived <code>GLSurfaceView</code> that uses VBOs.</p>
  <p>After switching back and forth between the two Activities a few times, the program crashes and throws the following exception:</p>
  <pre class="lang-none prettyprint-override"><code>Java.lang.RuntimeException: createContext failed: EGL_BAD_ALLOC
     at android.opengl.GLSurfaceView$EglHelper
        .throwEglException(GLSurfaceView.java:1079)
     at android.opengl.GLSurfaceView$EglHelper
        .throwEglException(GLSurfaceView.java:1071)
     at android.opengl.GLSurfaceView$EglHelper
        .start(GLSurfaceView.java:927)
     at android.opengl.GLSurfaceView$GLThread
        .guardedRun(GLSurfaceView.java:1248)
     at android.opengl.GLSurfaceView$GLThread
        .run(GLSurfaceView.java:1118)
  </code></pre>
  <p>Each time there is a context switch the VBO buffers are deleted, onStop() is called, and a new instance of the next Activity's <code>GLSurfaceView</code> is inflated.</p>
  <p>I refactored the program to run on only one <code>GLSurfaceView</code> and <code>Activity</code>, and the program seems to run without incident.</p>
  <p>Only polygons and colors are used, no textures.</p>
  <p>From doing some internet research, this is a <a href="http://code.google.com/p/android/issues/detail?id=16124" rel="nofollow noreferrer">recognized bug</a>.  So how do I do damage control?</p>
  <p>EDIT: I SOLVED THE PROBLEM (I FORGOT TO CALL ONPAUSE() / ONRESTART() ON THE VIEWS).</p>