ImageView does not display a bitmap on a real device

I get a bitmap from internal storage or from the Internet. When I try to display it in ImageView, it works on different versions of the emulator, but not on my Galaxy S I9000. The bitmap is simply not displayed.

protected void onPostExecute (Bitmap bmp) {
    progressBar.setVisibility(View.INVISIBLE);
    if (bmp != null) {
        imageView.setImageBitmap(bmp);
        imageView.setVisibility(View.VISIBLE);
    }
}
+3
source share
2 answers

This is likely to be the main problem when openGL does not accept textures larger than 2400x2400. It does not cause crashes, but does not work without displaying a bitmap image in ImageView.

You should always make sure that the bitmap is smaller than 2400 in both dimensions, and resize it before setting it if it is larger.

+3
source

,

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;

    }
0

All Articles