title: Android NPE when changing ImageView from different Layout
body: <p>I'm trying to change an ImageView in a different layout using code etc:</p>
  
  <pre><code>        ImageView imageView;
          imageView = (ImageView) findViewById(R.id.imageView1);
  
          imageView.setImageResource(R.drawable.wizardhat);
  </code></pre>
  
  <p>But it NPE's on R.drawable.wizardhat because it doesn't know what layout it belongs to, obviously, and it's not in the root layout:</p>
  
  <blockquote>
    <p>-main [where both includes are located]<br />
    -layout1[where code is included]<br />
    -layout2[where image is located]</p>
  </blockquote>
  
  <p>EDIT: Ok, I didn't really explain it: The view that the code runs in is inside a tabview. The layout that holds the tab view contains a include to a layout that contains a ImageView which i'm trying to edit. I didn't really word my question correctly, i'll edit it now :L</p>
  
  <p>Is this possible? Thanks :)</p>