• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spinner gets a null-value.

 
Sven Sylta
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand why my spinnner is causing a nullpointerexception. Row 19 in the javacode. Is there somebody who have had the same problem or is able to figure it out? Thanks.



fragment_main.xml


activity_main.xml
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're setting "activity_main" as the layout, not "fragment_main" - which contains the spinners.
 
Sven Sylta
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:You're setting "activity_main" as the layout, not "fragment_main" - which contains the spinners.


Thanks. I changed it to setContentView(R.layout.fragment_main); but it still didn't work. Then I removed this part from the onCreate()-method:



then, for some reason, it worked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic