android - Why do some images display black when loading data from a url? -


I am downloading images from a URL and storing them in a SQLite database table. Pictures are profile pictures for users. I store the image of the profile and the user's information in one line.

It mostly works almost all the images are loaded properly in my list However, I have around 300 users who are displayed with a black image. I have verified that by downloading the image through my web browser, users with black images on the URL hold a valid image.

Has anyone ever noticed why some of these users are showing a black image? I do not see any exception.

Here is my code:

  byterefer buff = new bytereferver (50); URL url = new URL (imageURL); URLConnection ucon = url.openConnection (); InputStream = ucon.getInputStream (); BufferedInputStream bis = new BufferedInputStream (is); Int current = 0; While ((current = bis.read ())! = -1) {baf.append (byte) on); }   

...

  // Then byte [] is stored in a SQLite Blob field. Baf.toByteArray ()     
  // Then I'm loading the Blob field in my view like this byte [] bytes = Cursor.gateblob (cursor.gate column index (on db.char.profile_IMAGE_COLUMN)); If (byte! = Null) {ImageView iv = (ImageView) v.findViewById (RID.profile_corean); Iv.setImageBitmap (BitmapFactory.decodeByteArray (bytes, 0, bytes length)); }    

A black image is usually a problem with alpha mixed / semi The symptom is the transparent picture I will manually download one of those pictures and to check it with some image editing application it will be detected as the exact format of that image.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -