If you encounter this problem in Netbeans, chances are you enabled the option “Compile on Save”. I do not know why this occurs because there are some cases where I enable this problem and I do not encounter the same error.
I remember creating an Android app way before Android phones came out there was no intuitive way to create a user interface other than to write one by scratch or perhaps use Eclipse’s own Android plugin UI maker.
Jump start 3 years later and I am trying to use Netbeans as my development IDE but there is no way to create a user interface on the fly. Thankfully for Google though, somebody created a tool to make his Java programming life easier.
Called Droid Draw, it can be used to build graphical user interfaces for the Android cell phone platform and he has shared it to the world for free! Good thing about this tool is that it is available for Linux, Windows and Mac OS.
You can drag and drop widgets onto different layouts and then use it to generate its equivalent XML code. While DroidDraw is not perfect, it is very useful to get you started with Android UI design and is a good tool to learn the various Views and ViewGroups in Android.