Android's definition of each resolution
How to calculate when a picture is stored in a format argb_8888
Memory consumption = picture length * Picture width/bytes
Picture length = picture original long
(Device dpi/folder dpi)
Picture width = Picture original width (device dpi/folder dpi)
Examples of validation are as follows:
Picture size 200 * 320, device is red meter dpi is 320, belongs to xhdpi device.
Verify that a picture is placed in hdpi and the following is the result of the code output:
Dd/mainactivity (13014): dpi:320 bitmap bytecount:456036
Picture length = (320/240) * 200 = 266.67
Picture width = (320/240) * 320 = 426.67
Memory consumption = 266.67 * 426.67 * 4 = 455116 approximately the same as the actual value
Verification two: Picture put xxhdpi, below for code output result:
D/mainactivity (13014): dpi:320 bitmap bytecount:113316
Picture length = (320/480) * 200 = 133.33
Picture width = (320/480) * 320 = 213.33
Memory consumption = 133.33 * 213.33 * 4 = 113774 is approximately the same as the actual value.
Android Bitmap Memory Usage Calculation formula