title: How to load a image from assets?
body: <p>i need to load a image from assets to avoid a froyo 2.2.2 bug resizing POT images in some particular cases. The way to avoid it is loading the image files from assets dir.</p>
  <p>I'm trying to do with this:</p>
  <pre><code>String imagePath = &quot;radiocd5.png&quot;;
  AssetManager mngr = context.getAssets();
  // Create an input stream to read from the asset folder
  InputStream is = null;
  try {
      is = mngr.open(imagePath);
  } catch (IOException e1) { e1.printStackTrace();}
      
  //Get the texture from the Android resource directory
  //InputStream is = context.getResources().openRawResource(R.drawable.radiocd5);
  Bitmap bitmap = null;
  try {
      //BitmapFactory is an Android graphics utility for images
      bitmap = BitmapFactory.decodeStream(is);
  
  } finally {
      //Always clear and close
      try {
          is.close();
          is = null;
      } catch (IOException e) {}
  }
  </code></pre>
  <p>But i am getting NullPointerException on the line <code>is.close();</code></p>
  <p>i capture a FileNotFoundException: radiocd5.png, but that file is on my assets directory :S</p>
  <p>What am i doing bad? The file is called <code>radiocd5.png</code> and it is on the <code>assets</code> directory</p>