create a transparent image programmatically in android
<p>i am getting an image from web server (<strong>which has transparent background</strong>).now i need to save this image on my sdcard and show it to user.but when i save the image to sdcard.. it saves with a black background..i need this image with background..</p>

<p>i hv tried following methods to save the image ---</p>

<p>Method 1:</p>

<pre><code>Bitmap bitmap = BitmapFactory.decodeStream(is);
byte[] b;
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 75, bytes);
b = bytes.toByteArray();
 try {
  File myFile = new File("/sdcard/" + image_id + ".jpg");
  myFile.createNewFile();
  OutputStream filoutputStream = new FileOutputStream(myFile);
  filoutputStream.write(b);
  filoutputStream.flush();
  filoutputStream.close();
        }catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    Log.d("file", "not created");
   }
</code></pre>

<p>Method 2:</p>

<pre><code>MediaStore.Images.Media.insertImage(getContentResolver(),
   bitmap, "sample", "image/png");
</code></pre>

<p>plz help...</p>
