title: Overlaying a transparent bitmap over an imageview
body: <p>I'm making an image editing app where the user can touch the screen and place a "sticker" over their photo.</p>
  
  <p>My stickers all have green backgrounds (0, 255, 0) that I'd like to make transparent.  However, the pixels don't come out as transparent, but black instead.</p>
  
  <p>Here's my code to load a transparent bitmap:</p>
  
  <pre><code>private Bitmap transparentBitmap(int id)
  {
      BitmapFactory.Options bmOptions = new BitmapFactory.Options();
      bmOptions.inMutable = true;
  
      Bitmap bitmap = BitmapFactory.decodeResource(getResources(), id, bmOptions);
  
      int width = bitmap.getWidth();
      int height = bitmap.getHeight();
      int[] pixels = new int[width * height];
  
      bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
  
      for (int y = 0; y &lt; height; y++)
      {
          for (int x = 0; x &lt; width; x++)
          {
              int index = y * width + x;
  
              if (pixels[index] == Color.GREEN)
              {
                  pixels[index] = Color.argb(0, 0, 0, 0);
              }
          }
      }
  
      bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
  
      return bitmap;
  }
  </code></pre>
  
  <p>I load all the stickers in the beginning of the app, and when the user touches the screen somewhere, the graphic is copied from a static Bitmap from my Assets class:</p>
  
  <pre><code>private Bitmap getGFX(stickerTypes type)
  {
      switch(type)
      {
      case sweatDrop: return Assets.sweatDrop_GFX.copy(Config.ARGB_4444, true);
      case veins: return Assets.veins_GFX.copy(Config.ARGB_4444, true);
      default: return null; 
      }
  }
  </code></pre>
  
  <p>So like I said, my actual stickers are not showing up with transparent background, but with black backgrounds.  They're saved as .pngs.</p>
  
  <p>The only explanation I can think of is that the stickers' background pixels are being set to transparent relative to the background of the activity as opposed to the background of the users' picture, but that doesn't make much sense because the background of the activity is orange, not black.</p>