Android findViewById is returning NULL
<p>sometime I have a strange problem with my xml views and contained sub elements in Android Eclipse SDK.</p>

<p>For example, I have a xml view called main.xml with a LinearLayout and a TextView as only child, with the id <em>textView1</em>. Everything works fine for a (long) time. When doing some major code changes, it <strong>might</strong> happen, that <code>findViewById(R.id.textView1);</code> starts returning <em>null</em>. Recompilation does not change anything. That is strange.</p>

<p>After some time I found a workaround... I copied <em>main.xml</em> to <em>main2.xml</em> and changed <code>setContentView(R.layout.main)</code> to <code>setContentView(R.layout.main2)</code> and everything was working fine againg, without changing anything other than the layout reference, even the layout itself was only copied. No content was modified. After the first working run, I can delete <em>main2.xml</em> and set the layout back to <code>R.layout.main</code>. No more NullPointerException.</p>

<p>Does someone have an idea what is going wrong and how to fix this without doing the stupid copy thing?</p>

<p>Best,
Hacksteak</p>
