Hi, I'm having some troubles with the menu I just added to my app. I'm using a basic
Java: @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem item = menu.add(0,1,0,"Bookmark"); item = menu.add(0,2,0,"Remove Bookmark"); return true; } to create my menu, and a Java: public boolean onOptionsItemSelected(MenuItem item) { if(item.getItemId()==1){ ..... to make it do things. Now the trouble is, occasionally, when i start my app up for the first time, or do a fresh install when testing it, and i click the menu button, it's gives me a force close error. It only seems to do it the first time on the very first screen. If i click either of my other buttons that refresh the view it tends not to do it, or, if you get it to open up and work once, it tends to be stable after that... It's driving me a bit crazy though, cause I can't see anything obvious wrong with my code, or why it would want to crash on a simple thing such as the menu screen... This is what logcat throws up when the app crashes, but it doesn't mean a whole lot to me yet... Quote: 07-16 18:11:42.721: ERROR/AndroidRuntime(21831): Uncaught handler: thread main exiting due to uncaught exception 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): android.view.InflateException: Binary XML file line #17: Error inflating class java.lang.reflect.Constructor 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.view.LayoutInflater.createView(LayoutInflater.java:512) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java: 564) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.view.LayoutInflater.inflate(LayoutInflater.java:385) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at com.android.internal.view.menu.MenuBuilder$MenuType.getMenuView (MenuBuilder.java:196) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at com.android.internal.view.menu.MenuBuilder.getMenuView (MenuBuilder.java:322) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at com.android.internal.policy.impl.PhoneWindow.initializePanelContent (PhoneWindow.java:930) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at com.android.internal.policy.impl.PhoneWindow.openPanel (PhoneWindow.java:528) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel (PhoneWindow.java:693) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java: 1367) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent (PhoneWindow.java:1684) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java: 2188) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2158) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.view.ViewRoot.handleMessage(ViewRoot.java:1490) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.os.Handler.dispatchMessage(Handler.java:99) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.os.Looper.loop(Looper.java:123) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.app.ActivityThread.main(ActivityThread.java:3948) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at java.lang.reflect.Method.invokeNative(Native Method) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at java.lang.reflect.Method.invoke(Method.java:521) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:782) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at dalvik.system.NativeStart.main(Native Method) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): Caused by: java.lang.reflect.InvocationTargetException 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at com.android.internal.view.menu.IconMenuView.<init>(IconMenuView.java: 140) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at java.lang.reflect.Constructor.constructNative(Native Method) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.view.LayoutInflater.createView(LayoutInflater.java:499) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): ... 21 more 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:363) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:212) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.graphics.drawable.Drawable.createFromResourceStream (Drawable.java:663) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.content.res.Resources.loadDrawable(Resources.java:1637) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): at android.content.res.TypedArray.getDrawable(TypedArray.java:548) 07-16 18:11:42.991: ERROR/AndroidRuntime(21831): ... 25 more I'm running this direct on my device through the usb, but it also crashes the emulator too. any ideas? Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---