title: Random application crashes - Fatal developer error
body: <p>I'm currently developing an Android Game Application and am almost done but stumbled upon some problems. I had no need for Google Play Services in my game until now, when i need to implement leaderboards and achievements. This is where the problem popped up. After adding required libraries I made all my game activities extend BaseGameActivity. The first problem that showed up was regarding the calls of </p>
  
  <pre><code>         requestWindowFeature(Window.FEATURE_NO_TITLE);
           getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
           WindowManager.LayoutParams.FLAG_FULLSCREEN);
  </code></pre>
  
  <p>and it said that i have to call requestFeature() before adding content, which I think I did , since I'm calling <code>setContentView</code> after it. I decided to resolve (better expression would be ignore) this problem by commenting above code. After running the application after that, every times it crashes after a random period of time giving me the following error:</p>
  
  <pre><code>08-17 13:55:43.879: I/dalvikvm(30369): Could not find method android.view.View.getDisplay, referenced from method com.google.android.gms.games.internal.PopupManager$PopupManagerHCMR1.h
  08-17 13:55:43.879: W/dalvikvm(30369): VFY: unable to resolve virtual method 9019: Landroid/view/View;.getDisplay ()Landroid/view/Display;
  08-17 13:55:43.879: D/dalvikvm(30369): VFY: replacing opcode 0x6e at 0x0009
  08-17 13:55:43.910: W/PopupManager(30369): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
  08-17 13:55:43.940: D/dalvikvm(30369): GC_FOR_ALLOC freed 181K, 14% free 7567K/8711K, paused 22ms, total 22ms
  08-17 13:55:43.970: I/dalvikvm-heap(30369): Grow heap (frag case) to 12.105MB for 4008020-byte allocation
  08-17 13:55:44.020: D/dalvikvm(30369): GC_CONCURRENT freed 1K, 10% free 11480K/12679K, paused 15ms+2ms, total 52ms
  08-17 13:55:44.020: D/dalvikvm(30369): WAIT_FOR_CONCURRENT_GC blocked 7ms
  08-17 13:55:44.040: D/dalvikvm(30369): GC_FOR_ALLOC freed 0K, 10% free 11480K/12679K, paused 21ms, total 21ms
  08-17 13:55:44.080: I/dalvikvm-heap(30369): Grow heap (frag case) to 13.801MB for 1779572-byte allocation
  08-17 13:55:44.140: D/dalvikvm(30369): GC_CONCURRENT freed 0K, 9% free 13218K/14471K, paused 7ms+3ms, total 54ms
  08-17 13:55:44.140: D/dalvikvm(30369): WAIT_FOR_CONCURRENT_GC blocked 14ms
  08-17 13:55:44.430: D/libEGL(30369): loaded /system/lib/egl/libGLES_rhea.so
  08-17 13:55:44.640: D/BRCM_EGL(30369): eglCreateContext() config: 19 context: 0x4a087130, VC context 1, Thread 30369
  08-17 13:55:44.640: D/BRCM_EGL(30369): eglCreateWindowSurface() surface: 0x4a0871a8, VC surface: 1, Thread: 30369
  08-17 13:55:44.650: D/BRCM_EGL(30369): eglMakeCurrent(0x4a087130, 0x4a0871a8, 0x4a0871a8) Thread: 30369
  08-17 13:55:44.680: D/OpenGLRenderer(30369): Enabling debug mode 0
  08-17 13:55:44.850: D/dalvikvm(30369): GC_FOR_ALLOC freed 4730K, 38% free 9829K/15687K, paused 47ms, total 47ms
  08-17 13:55:44.890: D/dalvikvm(30369): GC_FOR_ALLOC freed &lt;1K, 34% free 10398K/15687K, paused 40ms, total 40ms
  08-17 13:55:44.890: I/dalvikvm-heap(30369): Grow heap (frag case) to 12.205MB for 1213956-byte allocation
  08-17 13:55:44.981: D/dalvikvm(30369): GC_CONCURRENT freed 0K, 27% free 11583K/15687K, paused 14ms+2ms, total 83ms
  08-17 13:55:44.981: D/dalvikvm(30369): WAIT_FOR_CONCURRENT_GC blocked 69ms
  08-17 13:55:44.981: D/dalvikvm(30369): WAIT_FOR_CONCURRENT_GC blocked 20ms
  08-17 13:55:48.814: D/AndroidRuntime(30369): Shutting down VM
  08-17 13:55:48.814: W/dalvikvm(30369): threadid=1: thread exiting with uncaught exception (group=0x415ae2a0)
  08-17 13:55:48.864: E/AndroidRuntime(30369): FATAL EXCEPTION: main
  08-17 13:55:48.864: E/AndroidRuntime(30369): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at com.google.android.gms.internal.hb$h.b(Unknown Source)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at com.google.android.gms.internal.hb$h.d(Unknown Source)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at com.google.android.gms.internal.hb$b.fv(Unknown Source)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at com.google.android.gms.internal.hb$a.handleMessage(Unknown Source)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at android.os.Handler.dispatchMessage(Handler.java:99)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at android.os.Looper.loop(Looper.java:137)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at android.app.ActivityThread.main(ActivityThread.java:4944)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at java.lang.reflect.Method.invokeNative(Native Method)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at java.lang.reflect.Method.invoke(Method.java:511)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
  08-17 13:55:48.864: E/AndroidRuntime(30369):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>I did some reading online and I think this might be due to my incorrect use of Threads in my app. The app works on the principle described <a href="http://www.techrepublic.com/blog/software-engineer/the-abcs-of-android-game-development-prepare-the-canvas/" rel="nofollow" title="here">here</a> i.e. uses a Handler, which never cause problems before, until my activity inherited BaseGameUtils. What could be causing there problems. I know these are two different question but both are related to the same thing - BaseGameActivity which caused my app to change it's behavior. Thanks ;)</p>