Download image from internet loss transparency

When I download an image from the Internet and save it to an SD card, the image has a black background if the original images do not have

httpRequest = new HttpGet(fileUrl); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = (HttpResponse) httpclient.execute(httpRequest); HttpEntity entity = response.getEntity(); BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); InputStream instream = bufHttpEntity.getContent(); Bitmap bm = BitmapFactory.decodeStream(instream); String file_path = Environment.getExternalStorageDirectory()+File.separator+"basquetMobile- images"; File dir = new File(file_path); if(!dir.exists()) dir.mkdirs(); File file = new File(dir, tipoImagen+idEquipo+".jpg"); FileOutputStream fOut = new FileOutputStream(file); bm.compress(Bitmap.CompressFormat.JPEG, 75, fOut); fOut.flush(); fOut.close(); 

Thanks for the help!

<strong โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’> [SOLUTION] <<<<<<<<<<<<<<<<<<โ†’ โ†’>

changes:

File File = new File (dir, tipoImagen + idEquipo + " .png ");

bm.compress (Bitmap.CompressFormat.PNG, 100, fOut);

<strong โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’> THANKS <! & L; <<<<<<<<<<<<<<<<โ†’ โ†’>

+4
source share
1 answer

changes:

File File = new File (dir, tipoImagen + idEquipo + ".png");

bm.compress (Bitmap.CompressFormat.PNG, 100, fOut);

+3
source

Source: https://habr.com/ru/post/1439277/


All Articles