Android - AlertDialog won't show BitmapDrawable

99 views Asked by At

In my app, I'm downloading a small Facebook profile picture and show it in an AlertDialog (as BitmapDrawable) along with the user first and last name.

Now, my problem is that on some devices the BitmapDrawable is shown in the AlertDialog (Android ~4.0) and on some it isn't (5.0 and above), but in all the devices the BitmapDrawable contains the right bitmap and I'm able to load that BitmapDrawable to an ImageView for example.

((ImageView)findViewById(R.id.imageView3)).setImageDrawable(bitmapDrawable); //Shown in the ImageView on all devices

AlertDialog ad = new AlertDialog.Builder(MainActivity.this)
                        .setTitle("From: " + name + " " + lastName)
                        .setMessage(theStr)
                        .setNeutralButton(theStr2, new myClick(marker, thePack))
                        .setIcon(bitmapDrawable)  //Not shown in the AlertDialog on all devices
                        .show();

Any idea?

UPDATE: Even in the debugger I can see the icon set in the AlertDialog and the debugger also allow me to view the bitmap of it and it's shown perfectly. It's just won't show up in the dialog and I don't know why.

1

There are 1 answers

1
Prokash Sarkar On BEST ANSWER
  1. Try setting a drawable from the resource just to see if that works.

  2. If I'm not wrong try changing the default app theme (It's weird but for me it worked in some special cases).

Also I've found this bug report while searching,

https://code.google.com/p/android/issues/detail?id=92929