I am receiving an inflation error when pressing the Menu button and adding a menu item in the onCreateOptionsMenu
method. I've included some of the error below.
The code is as follows, and works if I try it on its own and not as part of my activity as a whole. I don't think it's feasible to paste in the whole of my activity here (I have no idea which bit could be causing this), so am wondering if anyone has experienced this before?
public boolean onCreateOptionsMenu(Menu m) {
Log.d(TAG, "Menu Create");
this.menu = m;
m.add(0, 0, 0, "HAZAH!");
return true;
}
05-24 17:18:47.963: ERROR/AndroidRuntime(1658): android.view.InflateException: Binary XML file line #17: Error inflating class com.android.internal.view.menu.IconMenuItemView
05-24 17:18:47.963: ERROR/AndroidRuntime(1658): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
05-24 17:18:47.963: ERROR/AndroidRuntime(1658): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
05-24 17:18:47.963: ERROR/AndroidRuntime(1658): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
05-24 17:18:47.963: ERROR/AndroidRuntime(1658): Caused by: java.lang.reflect.InvocationTargetException
05-24 17:18:47.963: ERROR/AndroidRuntime(1658): at com.android.internal.view.menu.IconMenuItemView.<init>(IconMenuItemView.java:86)
05-24 17:18:47.963: ERROR/AndroidRuntime(1658): Caused by: java.lang.reflect.InvocationTargetException
05-24 17:18:47.963: ERROR/AndroidRuntime(1658): at com.android.internal.view.menu.IconMenuItemView.<init>(IconMenuItemView.java:86)
If I try pressing Menu with the debugger attached I see it stop here:
Suspended (exception InflateException)
ViewRoot.deliverKeyEventToViewHierarchy(KeyEvent, boolean) line: 2425
Thanks.