Out of Memory Exception while scroll Listview?

前端 未结 6 1078
温柔的废话
温柔的废话 2020-12-18 15:36

I refered through many resources but can\'t get right answer,

I have made an custom adapter to view images in a listview. This images are retrieved from memory card.

6条回答
  •  忘掉有多难
    2020-12-18 16:40

    You are using

    Bitmap myBitmap = BitmapFactory.decodeFile(i.getImagePath())
    

    to load bitmap.. which can load large bitmaps into the memory, make sure that you load them in required size only.

    Follow Loading Large Bitmaps Efficiently

    It is also a good practice to load these bitmaps in AsyncTask.

    For that follow Processing Bitmaps Off the UI Thread

提交回复
热议问题