title: android.view.InflateException, Android application crash when I try to open menu!
body: <p>I wrote a game (using GLSurfaceView) application for Android 2.2. I have the following error when I try to open the menu:</p>
  
  <p>android.view.InflateException: Binary XML file line #17: Error inflating class com.android.internal.view.menu.IconMenuView</p>
  
  <p>--------- Stack trace ---------</p>
  
  <pre><code>android.view.LayoutInflater.createView(LayoutInflater.java:513)
  android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
  android.view.LayoutInflater.inflate(LayoutInflater.java:385)
  android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  com.android.internal.view.menu.MenuBuilder$MenuType.getMenuView(MenuBuilder.java:197)
  com.android.internal.view.menu.MenuBuilder.getMenuView(MenuBuilder.java:323)
  com.android.internal.policy.impl.PhoneWindow.initializePanelContent(PhoneWindow.java:840)
  com.android.internal.policy.impl.PhoneWindow.openPanel(PhoneWindow.java:417)
  com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:603)
  com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1319)
  com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1648)
  android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2471)
  android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2441)
  android.view.ViewRoot.handleMessage(ViewRoot.java:1735)
  android.os.Handler.dispatchMessage(Handler.java:99)
  android.os.Looper.loop(Looper.java:123)
  android.app.ActivityThread.main(ActivityThread.java:4627)
  java.lang.reflect.Method.invokeNative(Native Method)
  java.lang.reflect.Method.invoke(Method.java:521)
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>This happen on some phones (on mine the error never occurs):</p>
  
  <p>My code is:</p>
  
  <pre><code>public class FinalKarate extends Activity
  {
      private KarateGLSurfaceView view = null;
      PowerManager.WakeLock wl = null;
  
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
  
          this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  
          final PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
          wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");           
  
          this.requestWindowFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                               WindowManager.LayoutParams.FLAG_FULLSCREEN);
          view = new KarateGLSurfaceView(this);
          setContentView(view);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu)
      {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.game_menu, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item)
      {
          // Handle item selection
          switch (item.getItemId())
          {
              case R.id.item01:
                  if ((view != null) &amp;&amp; (view.isPlayingGame()))
                  {
                      final boolean alreadyInPause = view.isInPause();
                      if (!alreadyInPause)
                          view.pauseGame();
                      new AlertDialog.Builder(this)
                      .setIcon(android.R.drawable.ic_dialog_alert)
                      .setTitle(R.string.abort_game)
                      .setMessage(R.string.abort_request)
                      .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
                          //@Override
                          public void onClick(DialogInterface dialog, int which) {
                              view.abortGame();    
                          }
                      })
                      .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
                          //@Override
                          public void onClick(DialogInterface dialog, int which) {
                              if (!alreadyInPause)
                                  view.resumeGame();    
                          }
                      })
                      .show();
                  }
                  return true;
  
              case R.id.item02:
                  if (view != null)
                  {
                      if (view.isInPause())
                          view.resumeGame();
                      else
                          view.pauseGame();
                  }
                  return true;
  
              case R.id.item03:
                  if (view != null)
                      view.toggleSimplifiedMode();
                  return true;
              default:
                  return super.onOptionsItemSelected(item);
          }
      }
  }
  </code></pre>
  
  <p>I wrong something? Please help!</p>
  
  <p>P.s: The xml file is the following (n.b.: I have replaced &lt; > with [ ]  to post here in the forum):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:id="@+id/item01" android:title="@string/abort_game"&gt;&lt;/item&gt;
      &lt;item android:id="@+id/item02" android:title="@string/pause_game"&gt;&lt;/item&gt;
      &lt;item android:title="@string/simplyMode" android:id="@+id/item03"&gt;&lt;/item&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>Other info:</p>
  
  <pre>
  --------- Cause ---------
  
  java.lang.reflect.InvocationTargetException
  
      com.android.internal.view.menu.IconMenuView.(IconMenuView.java:140)
      java.lang.reflect.Constructor.constructNative(Native Method)
      java.lang.reflect.Constructor.newInstance(Constructor.java:446)
      android.view.LayoutInflater.createView(LayoutInflater.java:500)
      android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
      android.view.LayoutInflater.inflate(LayoutInflater.java:385)
      android.view.LayoutInflater.inflate(LayoutInflater.java:320)
      com.android.internal.view.menu.MenuBuilder$MenuType.getMenuView(MenuBuilder.java:197)
      com.android.internal.view.menu.MenuBuilder.getMenuView(MenuBuilder.java:323)
      com.android.internal.policy.impl.PhoneWindow.initializePanelContent(PhoneWindow.java:840)
      com.android.internal.policy.impl.PhoneWindow.openPanel(PhoneWindow.java:417)
      com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:603)
      com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1319)
      com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1648)
      android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2471)
      android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2441)
      android.view.ViewRoot.handleMessage(ViewRoot.java:1735)
      android.os.Handler.dispatchMessage(Handler.java:99)
      android.os.Looper.loop(Looper.java:123)
      android.app.ActivityThread.main(ActivityThread.java:4627)
      java.lang.reflect.Method.invokeNative(Native Method)
      java.lang.reflect.Method.invoke(Method.java:521)
      com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
      com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
      dalvik.system.NativeStart.main(Native Method)
  -------------------------------
  
  </pre>