title: FATAL EXCEPTION: GLThread on 1st launch
body: <p>I made an app, that works good, but something strange happens. When you install the app for the 1st time, open it and put onPause, lock your phone and then you resume it clicking on icon, when it is loaded, click on BACK button (Gdx.app.exit();), It gives me the following exception:</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: GLThread 1723
         java.lang.NullPointerException
         at com.badlogic.gdx.Game.render(Game.java:46)
         at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:459)
         at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1524)
         at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
  </code></pre>
  
  <p>After you launch the app again, and it works properly.
  So, trying to figure out this error, I made a new project with gdx-setup.jar. I didn't change AndroidLauncher, neither gradle. Only in manifest I changed landscape to portrait. And I have only 4 classes with almost no code and the problem is still there. May be somebody know what happens. I will appreciate any help. Thanks! </p>
  
  <p>My code:</p>
  
  <p>Main class.</p>
  
  <pre><code>public class TenPuzzle extends Game {
  
      @Override
      public void create () {
  
          setScreen(new SplashScreen(this));
      }
  
  }
  </code></pre>
  
  <p>SpalashScreen.java</p>
  
  <pre><code> public class SplashScreen extends Screens{
  
      public SplashScreen(TenPuzzle ten) {
          super(ten);
  
          Gdx.app.log("1010", "SPLASH");
  
      }
  
      @Override
      public void draw(float delta) {
          game.setScreen(new MainMenuScreen(game));
  
      }
  
      @Override
      public void update(float delta) {
  
      }
  
  }
  </code></pre>
  
  <p>MainMenuScreen.java</p>
  
  <pre><code> public class MainMenuScreen extends Screens {
  
  
      public MainMenuScreen(TenPuzzle ten) {
          super(ten);
  
          Gdx.app.log("1010", "Main menu screen");
      }
  
      @Override
      public void draw(float delta) {}
  
      @Override
      public void update(float delta) {}
  
      public boolean keyDown(int keycode) {
  
          if(keycode == Input.Keys.BACK){
                  Gdx.app.exit();
          }
          return false;
      }
  
  }
  </code></pre>
  
  <p>and Screens.java</p>
  
  <pre><code>public abstract class Screens extends InputAdapter implements Screen {
  
      public static float SCREEN_WIDTH = 575;
      public static float SCREEN_HEIGHT = 1024;
  
      public TenPuzzle game;
  
      public OrthographicCamera oCam;
      public SpriteBatch batcher;
      public Stage stage;
      public static float diffViewportStage;
      public Screens(TenPuzzle game) {
          this.game = game;
          stage = new Stage(new ExtendViewport(Screens.SCREEN_WIDTH,
                      Screens.SCREEN_HEIGHT, 768, 1224));
  
          oCam = new OrthographicCamera(stage.getWidth(), stage.getHeight());
              oCam.position.set(stage.getWidth()/ 2,stage.getHeight()/2f, 0);
  
  
          InputMultiplexer input = new InputMultiplexer(this, stage);
          Gdx.input.setInputProcessor(input);
          Gdx.input.setCatchBackKey(true);
  
      }
  
      @Override
      public void render(float delta) {
  
          update(delta);
          oCam.update();
          stage.act(delta);
          Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
          draw(delta);
          stage.draw();
  
      }
  
      public abstract void draw(float delta);
  
      public abstract void update(float delta);
  
      @Override
      public void resize(int width, int height) {
  
          stage.getViewport().update(width, height, true);
  
      }
  
      @Override
      public void show() {
      }
  
      @Override
      public void hide() {
  
      }
  
      @Override
      public void pause() {
      }
  
      @Override
      public void resume() {
  
      }
  
      @Override
      public void dispose() {
          stage.dispose();
  
      }
  
      @Override
      public boolean keyDown(int keycode) {
          return super.keyDown(keycode);
      }
  
  
  }
  </code></pre>