I cannot figure out why my new activity wont start (I have omitted all the irrelevant code)
I am trying to display a main menu once the time has ended
public class GRenderer implements Renderer
{
public void timer ()
{
Game.currentGameTime = System.currentTimeMillis();
Game.ellapsedTime = Game.currentGameTime - Game.gameStartTime;
if (Game.ellapsedTime > 10000)
{
// THIS IS WHEN The GAME SHOULD END
Toast.makeText(Game.context, "10Seconds", Toast.LENGTH_SHORT).show();
Intent MainMenu = new Intent(getApplicationContext(),MainMenu.class);
startActivity(MainMenu);
}
}
@Override
public void onDrawFrame(GL10 gl) // when drawing to screen
{
timer();
}
}
Here is the logcat:
12-13 18:28:28.500: E/AndroidRuntime(20184): FATAL EXCEPTION: GLThread 1386
12-13 18:28:28.500: E/AndroidRuntime(20184): Process: com.damienrenner.spacefruitshooter, PID: 20184
12-13 18:28:28.500: E/AndroidRuntime(20184): java.lang.NullPointerException
12-13 18:28:28.500: E/AndroidRuntime(20184): at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:109)
12-13 18:28:28.500: E/AndroidRuntime(20184): at com.damienrenner.spacefruitshooter.GameLoop.timer(GameLoop.java:280)
12-13 18:28:28.500: E/AndroidRuntime(20184): at com.damienrenner.spacefruitshooter.GameLoop.onDrawFrame(GameLoop.java:296)
12-13 18:28:28.500: E/AndroidRuntime(20184): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
12-13 18:28:28.500: E/AndroidRuntime(20184): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)