-4

when I try to define an spinner, this Run time exception is thrown. Why?enter image description here enter image description here

Narendra Singh
  • 3,990
  • 5
  • 37
  • 78
DanialAbdi
  • 183
  • 1
  • 4
  • 17

1 Answers1

3

You have to initialize your spinner in the onCreate method, so move

CARS_TYPE = (Spinner)findViewById(...);

inside onCreate() after setContentView

one more thing, CARS_TYPE should not be a constant, better if you call it carsType instead

Stefano Vuerich
  • 996
  • 1
  • 7
  • 28