Spent about an hour on this so I thought I'd save somebody else the trouble. Using Eclipse 3.6.2.
My call to findViewById a GUI widget keep returning null. Check the code and xml over and over and over, no problems. Finally exited and restarted Eclipse and开发者_如何学编程 suddenly findViewById worked.
The next time you can just delete the R.java file, and let Eclipse regenerate it, then it should work too.
I find I have been needing to do Project > Clean when adding a new resource. If I simply tell it to build, the R.java will regenerate, but the resource will not be optimized and packaged in the bundle. Chalk it up to an Android bug and remember to clean.
精彩评论