Using resources across classes? <p>I have a GameLoop class with a ParticleSystem object defined in it.</p> <p>The ParticleSystem contains an array of Particle objects - I don't want to have to load an image for each individual particle, id like to just be able to draw from a source image in the GameLoop class - how can I do this in an efficient manner?</p> <p><strong>SOLUTION:</strong></p> <p>Here is what Dan S helped me come up with:</p> <pre><code>public class ResourceManager { Context mContext; public final HashMap&lt;String, Bitmap&gt; Texture = new HashMap&lt;String, Bitmap&gt;(); //Constructor public ResourceManager(Context context) { mContext = context; Texture.put("particle1", loadBitmap(R.drawable.particle1)); } public Bitmap getBitmap(String key) { return Texture.get(key); } /** Load an image */ protected Bitmap loadBitmap(int id) { return BitmapFactory.decodeResource(mContext.getResources(), id); } } //End ResourceManager </code></pre> <p>then define it in a class:</p> <pre><code>rm = new ResourceManager(mContext); </code></pre> <p>And then pass the rm variable down the way:</p> <pre><code> ParticleSystem.Draw(rm, canvas); { Particle.Draw(rm, canvas); } </code></pre> <p>and in Particle class, there is a String assetKey I set in constructor - so that I can refer to the Bitmap by a name:</p> <pre><code>public void doDraw(ResourceManager rm, Canvas canvas) { canvas.drawBitmap(rm.getBitmap(AssetKey), xpos, ypos, null); } </code></pre> <p>I hope this is helpful to someone else also.</p>