user1373733
user1373733

Reputation: 31

ImageView not displaying Bitmap on real device

I get an Bitmap from internal storage or from the internet. When I try to display it in a ImageView, it works on different Emulator versions but not on my Galaxy S I9000. The Bitmap simply doesn't show up.

protected void onPostExecute (Bitmap bmp) {
    progressBar.setVisibility(View.INVISIBLE);
    if (bmp != null) {
        imageView.setImageBitmap(bmp);
        imageView.setVisibility(View.VISIBLE);
    }
}

Upvotes: 3

Views: 1781

Answers (2)

I used this method to help me in displaying the image

public static Drawable ToDrawable(Resources r, byte[] encodedString) 
    {
        if (encodedString == null)
            return null;

        Bitmap bmp = BitmapFactory.decodeByteArray(encodedString, 0, encodedString.length);
        Drawable drawable = new BitmapDrawable(r, bmp);
        // bmp.recycle();
        return drawable;

    }

Upvotes: 0

Captain Blammo
Captain Blammo

Reputation: 1897

This is highly likely to be an underlying issue with openGL not accepting textures larger than 2400x2400. It doesn't cause crashes, but fails by not displaying the Bitmap in an ImageView.

You should always ensure that the Bitmap is smaller than 2400 in both dimensions and resize it before setting it on your view if it is larger.

Upvotes: 3

Related Questions