I am trying to assign an icon to an alertdialog but keep getting a memory error (seems to be from the size of the icon).
What size should the icon be for an alertdialog?
Builder adb = new AlertDialog. Builder(this); Dialog d = adb. setView(new View(this)). create(); // (That new View is just there to have something inside the dialog that can grow big enough to cover the whole screen.)
You can add an icon with the following code: Dialog dialog = new Dialog(context); dialog. requestWindowFeature(Window. FEATURE_LEFT_ICON); dialog.
AlertDialog. A dialog that can show a title, up to three buttons, a list of selectable items, or a custom layout.
AlertDialog is a lightweight version of a Dialog. This is supposed to deal with INFORMATIVE matters only, That's the reason why complex interactions with the user are limited. Dialog on the other hand is able to do even more complex things .
32x32 at mdpi. See here. Very easy to google.
Most Internet results will lead you that HDPI is the max icon you need. This is WRONG.
Just tested as a part of the current project and this is what get you the best result:
LDPI 24px
MDPI 32px
HDPI 48px
XHDPI 64px
XXHDPI 96px
XXXHDPI 128px
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With