Android load image into variable to be used thoughtout app
<p>I'm using Android Developer Studio v2.2.2 and am having trouble figuring out how to load an image into a variable that can be used throughout the app. I've been trying ImageView with no success.</p>

<p>The following is throws a java.lang.NullPointerException</p>

<pre><code>// At top of the class declaration
private ImageView image1;

// then in the onCreate method
image1.setImageResource(R.drawable.myImage);
</code></pre>

<p>myImage is a .png image in the res/drawable folder.</p>

<p>myImage exists and has been used in other spots.</p>

<p>I've tried doing this with Drawable and getting the same results, also getDrawable is deprecated anyways.</p>

<p>Any help would be greatly appreciated, thanks...</p>