why this runtime is occured :Unable to instantiate activity ComponentInfo?

只愿长相守 提交于 2019-12-13 09:56:09

问题


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



来源:https://stackoverflow.com/questions/30473270/why-this-runtime-is-occured-unable-to-instantiate-activity-componentinfo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!