title: android semitransparent bitmap background is black
body: <p>I'm trying to create semitransparent bitmaps, I used this code:</p>
  
  <pre><code>private Bitmap SemiTransparent(Bitmap bitmap, int opacity) {
  
  
      // Create an array to hold the data of bitmap for which semi transparent bitmap is to be obtained
      int[] data = new int[(int)(bitmap.getWidth()) + 1];
  
      for (int y = 0; y &lt; bitmap.getHeight(); ++y)
      {
             // Get a single line of data
            bitmap.getPixels(data, 0, bitmap.getWidth(), 0, y,bitmap.getWidth(), 1);     
  
       // Reset the alpha values 
             for (int x = bitmap.getWidth(); x&gt;0; --x) 
             {
  
                  data[x] = (data[x] &amp; 0x00ffffff) | (opacity &lt;&lt; 24);
             }     
            //fill alphaBitmap data
             bitmap.setPixels(data, 0, bitmap.getWidth(), 0, y, bitmap.getWidth(), 1);
  
      }
  
  
           return bitmap;
  }
  </code></pre>
  
  <p>The only problem is the background (transparent) color is always black - how can I modify this to make the background Color completely transparent and the rest still semitransparent?</p>