Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5985551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:32:44+00:00 2026-05-22T22:32:44+00:00

My program switches between two Activities that each inflate a derived GLSurfaceView that uses

  • 0

My program switches between two Activities that each inflate a derived GLSurfaceView that uses VBOs.

After switching back and forth between the two Activities a few times, the program crashes and throws the following exception:

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)

Each time there is a context switch the VBO buffers are deleted, onStop() is called, and a new instance of the next Activity’s GLSurfaceView is inflated.

I refactored the program to run on only one GLSurfaceView and Activity, and the program seems to run without incident.

Only polygons and colors are used, no textures.

From doing some internet research, this is a recognized bug. So how do I do damage control?

EDIT: I SOLVED THE PROBLEM (I FORGOT TO CALL ONPAUSE() / ONRESTART() ON THE VIEWS).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:32:45+00:00Added an answer on May 22, 2026 at 10:32 pm

    Annoyingly I can’t post a comment yet, but I think you mean onResume, not onRestart. Your Activity can be paused without being stopped, which would cause onPause, but not onRestart.

    This image (from the Activity docs) shows this activity life cycle very nicely:

    http://developer.android.com/images/activity_lifecycle.png

    In short, remember to pass onPause and onResume to both your super and to the GLSurfaceView.

    From http://android-developers.blogspot.com/2009/04/introducing-glsurfaceview.html:

    public class ClearActivity extends Activity {
        ... snip ...
    
        @Override
        protected void onPause() {
            super.onPause();
            mGLView.onPause();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            mGLView.onResume();
        }
    
        private GLSurfaceView mGLView;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A program receives a list of Messages (base type). Each message in the list
Strange program hang, what does this mean in debug? After attaching windbg I found
The program that I am currently assigned to has a requirement that I copy
A program that I work on assumes that the UUID generated by the Windows
My program has to read files that use various encodings. They may be ANSI,
I am writing a quote-matching program in which two Abstract Factory Patterns are required,
Program followed by output. Someone please explain to me why 10,000,000 milliseconds from Jan
Most program languages have some kind of exception handling; some languages have return codes,
My program generates relatively simple PDF documents on request, but I'm having trouble with
My Program overrides public void paint(Graphics g, int x, int y); in order to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.