Resolved : findViewById() returns null Android

First solutionc can be regenerate file.

Try following :

Eclipse -> Project -> Clean

Sometimes during building, the 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

Your email address will not be published.