Android setBackgroundResource cause out of memory excepiton

后端 未结 2 1553
遥遥无期
遥遥无期 2020-12-04 22:49

I\'m working on a gamebook application that shows 12 views in a ViewPager. This is my custom PagerAdapter :

private class ImagePagerAdapter extends PagerAdap         


        
2条回答
  •  情深已故
    2020-12-04 23:04

    I solved! All your hints were good but the real problem was the "/drawable" folder! I had all the pictures in "/drawable" generic folder that is considered by the system like "/drawable/mdpi", so when I were running in devices with hdpi or more the images were resized, and became too big which cause OutOfMemoryException!

    Now i'm using "/drawable-nodpi" to store my images. This folder works like "/drawable" but the images are never resized!

提交回复
热议问题