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

  • Home
  • SEARCH
  • 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 6648751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:41:32+00:00 2026-05-26T00:41:32+00:00

Hey I am trying to just set up the basic structure for some basic

  • 0

Hey I am trying to just set up the basic structure for some basic graphics. However, when I run this code the app makes me force quit on the emulator. I am using Android 2.3.

I used this website to get this far http://developer.android.com/resources/tutorials/opengl/opengl-es10.html

Please help. I am familiar with OpenGL just not for Android

public class SampleActivity extends Activity {
/** Called when the activity is first created. */
private GLSurfaceView mGLView;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mGLView = new GLSurfaceView(this);     
    setContentView(mGLView);
}

@Override protected void onPause()
{
    super.onPause();
    mGLView.onPause();
}

@Override protected void onResume()
{
    super.onResume();
    mGLView.onResume();

}

   }

class SampleSurfaceView extends GLSurfaceView
{

public Sample2SurfaceView(Context context) {
    super(context);

    setRenderer(new SampleRenderer());
}

}

public class SampleRenderer implements GLSurfaceView.Renderer 
{
private FloatBuffer triangleVB;
public void onSurfaceCreated(GL10 gl, EGLConfig config)
{    
    gl.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
}       
public void onDrawFrame(GL10 gl)
{        // Redraw background color    
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    }    
public void onSurfaceChanged(GL10 gl, int width, int height)
{   
    gl.glViewport(0, 0, width, height);
    }

10-03 00:25:57.561: ERROR/AndroidRuntime(330): FATAL EXCEPTION: main
10-03 00:25:57.561: ERROR/AndroidRuntime(330): java.lang.RuntimeException: Unable to resume activity {android.SampleActivity}: java.lang.NullPointerException
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2120)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2135)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1668)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.os.Handler.dispatchMessage(Handler.java:99)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.os.Looper.loop(Looper.java:123)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at java.lang.reflect.Method.invokeNative(Native Method)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at java.lang.reflect.Method.invoke(Method.java:507)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at dalvik.system.NativeStart.main(Native Method)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): Caused by: java.lang.NullPointerException
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.opengl.GLSurfaceView.onResume(GLSurfaceView.java:512)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.TagToMobileAlbum.TagToMobileAlbumActivity.onResume(TagToMobileAlbumActivity.java:28)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.app.Activity.performResume(Activity.java:3832)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2110)
10-03 00:25:57.561: ERROR/AndroidRuntime(330): … 12 more
10-03 00:34:05.661: ERROR/AndroidRuntime(340): FATAL EXCEPTION: main
10-03 00:34:05.661: ERROR/AndroidRuntime(340): java.lang.RuntimeException: Unable to resume activity {android.TagToMobileAlbum/android.TagToMobileAlbum.TagToMobileAlbumActivity}: java.lang.NullPointerException
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2120)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2135)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1668)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.os.Handler.dispatchMessage(Handler.java:99)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.os.Looper.loop(Looper.java:123)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at java.lang.reflect.Method.invokeNative(Native Method)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at java.lang.reflect.Method.invoke(Method.java:507)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at dalvik.system.NativeStart.main(Native Method)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): Caused by: java.lang.NullPointerException
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.opengl.GLSurfaceView.onResume(GLSurfaceView.java:512)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.SampleActivity.onResume(
SampleActivity.java:28)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.app.Activity.performResume(Activity.java:3832)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2110)
10-03 00:34:05.661: ERROR/AndroidRuntime(340): … 12 more

  • 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-26T00:41:32+00:00Added an answer on May 26, 2026 at 12:41 am

    I was having the same problem and, from looking at other sample code, managed to solve it. I’m not sure why it makes a difference but I moved the call to setRenderer into the Activity constructor and this seems to have solved the problem. So your onCreate would be something like:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mGLView = new GLSurfaceView(this);
        mGLView.setRenderer(new SampleRenderer())
        setContentView(mGLView);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all, so I'm just trying to make a basic chatbox on my site
Hey having some trouble trying to maintain transparency on a png when i create
Hey everyone, I am trying to run the following program, but am getting a
Hey, I'm trying to set variables in my CSS so that I can allow
Hey guys I am having trouble trying to convert my web app to support
I've been trying to set up some sort of geometry batching for a week
Hey guys, just trying to decode my signed request.. I've done a bit of
Hey, I'm just trying to get things 100% clear in my head in regards
Hey guys, quick question, just trying to filter a user's first and last name
Hey there, i am trying to make a little app that will serve multiple

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.