• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Cannot identify the problem (java.lang.NullPointerException)  RSS feed

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

everything was working fine till yesterday, and that out of nowhere appeared following problem. Once the main activity is started there are two buttons which based on the selection initiate new activity. The onClick method checkStats works normally, however method startHappinessMeter (uppon click) results in "Unfortunately, Happy App has stopped":

Main Activity code:





Error which is returned when I press the button:





I checked the line 26 in below provided java file and I cant understand why it guides me to the greatBtn onClick listener?




Help would me much appreciated!

best regards
 
Lovro Bajc
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found the solution In the OnCreate the setContentView was missing.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!