• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot identify the problem (java.lang.NullPointerException)

 
Lovro Bajc
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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!