I know its asked many times here, I have gone through many answers, but failed to understand 1 think.
I am trying to show a .jpg image in an ImageView
<ImageView
android:id="@+id/bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/bg" />
and that bg.jpg is 650 k.b in size with 1600 x 1700 WxH resolution placed in drawable folder
.
and I faced a out of memory error on few devices.
I was under the impression that the memory size is what matters and 650 k.b is not much. But when I read Displaying Bitmaps Efficiently and Loading Large Bitmaps Efficiently: It looks like the resolution is what matters. And if the configuration is ARGB_8888 according to those pages, my image would be taking 1600 x 1700 x 4 bytes, which is more than 10 m.b
So,
Even when 10 m.b is less than the per app limit of 16 m.b why it gave me this error?
As explained in the above links, if I scale down the Image, there are devices which have resolution of 1200 x 2000 WxH where I would not be able to scale and hence I get the same Error.
I see apps which load multiple full screen images(scrollable) and I am using only 1 :(
what am I missing?