java.lang.OutOfMemoryError BitmapFactory.nativeDecodeAsset()

前端 未结 2 837
南笙
南笙 2021-01-05 02:08

Hi i am creating an app about traffic signs. traffic signs are in .png format. some of them I am showing in horizontalscrollview. But when try to open activities , I get thi

2条回答
  •  情深已故
    2021-01-05 03:10

    Use sampling to read bitmap. May be error occurred due to memory leaks.

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize = 4;
    
    Bitmap bitmap=BitmapFactory.decodeFile(path,options);
    

提交回复
热议问题