FindViewById() not finding View

前端 未结 6 1738
青春惊慌失措
青春惊慌失措 2020-12-06 12:09

Just added a new button to my already-working-fine layout, but the findViewById function seems to be angry with something I don\'t get to understand.

Here\'s a bit o

6条回答
  •  独厮守ぢ
    2020-12-06 12:39

    1. Clean your project in Eclipse.
    2. Make sure the id is not duplicated
    3. Remove the button, save and add the button again and build the code.
    4. Make sure the correct R file is imported.

    If its a syntax related problem, then its got to do with compile time stuff.

    If its a problem when the code executes, make sure the layout is inflated. If the listview is found, then the button also must definitely be found.

提交回复
热议问题