• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Spinner gets a null-value.

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic