I'm implementing an image cache for PNGs, downloaded from the web.

Works well so far, besides that on images with a transparent background, 
get a light-green background, when they are read from the cache (external 
storage).

Tested on 3 devices, the problem was in 2 of them, a Samsung Galaxy and HTC 
desire. The third one, a Galaxy Nexus, has not this problem.

The relevant parts of code:

Save to file:

FileOutputStream outputStream = new FileOutputStream(fileUri);
image.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
outputStream.flush();
outputStream.close();

Read file:

File file = new File(fullCacheDir.toString(), fileName);

Download from web:

DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet request = new HttpGet(urlString);
HttpResponse response = httpClient.execute(request);
InputStream is = response.getEntity().getContent();

TypedValue typedValue = new TypedValue();
typedValue.density = TypedValue.DENSITY_DEFAULT;
Drawable drawable = Drawable.createFromResourceStream(null, typedValue, is, 
"src");

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to