• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Inflating menu closes application

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am facing a little different kinda problem. When I run my autogenerated helloworld code, it works everything fine, but as soon as I inflate a menu file in the onCreateOptionsMenu() method, the app blinks for a while and gets closed.



 
Saloon Keeper
Posts: 7597
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the app closes, then there should be something in the logcat. Post the stack trace here, it should give you starting points on what's going wrong.
 
Greenhorn
Posts: 11
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I reproduced your code, and it runs with no problems. A few things to double check.


  • Check your resource layout file names are all correct, and that they are correctly written (no missing or malformed XML for example)


  • Check you have included your MainActivity in your manifest with the correct intent filter and activity name.


  • Check your API version you are using, in particular, your themes. Sometimes this can be problematic, Even if you are using the AppCompat libraries


  • However, it is important, as Tim Says, you need to post the Log, then we can see what's happening
     
    reply
      Bookmark Topic Watch Topic
    • New Topic