First solutionc can be regenerate R.java file.

Try following :

Eclipse -> Project -> Clean

Sometimes during building, the R.java class messes up and causes wrong references to id’s.
so by cleaning project it may solve your problem.


Second solution can be Possibly, you are calling findViewById before calling setContentView. If that the case, call findViewById AFTER calling setContentView. because you are calling it too early. Wait until onFinishInflate().

Make sure you have written setContentView() before findViewById()

Hope it helps

Leave a Reply