when I try to define an spinner, this Run time exception is thrown. Why?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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