ethanhua / Skeleton

A library provides an easy way to show skeleton loading view like Facebook and Alipay
3.68k stars 457 forks source link

java.lang.OutOfMemoryError #4

Closed ClaudeHangui closed 7 years ago

ClaudeHangui commented 7 years ago

I'm using the Shimmerlayout in a viewpager....Each fragment of the viewpager has a recyclerview... So upon scrollling inside one of my fragments, my app crashed and I get this error:

at android.graphics.Bitmap.nativeCreate(Native Method)                                                                                    
at android.graphics.Bitmap.createBitmap                                                                                        

Here is the method in question: `private Bitmap createBitmap(int width, int height) { try { return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); } catch (OutOfMemoryError e) { System.gc(); return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); }

}`

ethanhua commented 7 years ago

@ClaudeHangui can you provide more details ? generally, it's because you load larger bitmap , so check the memory usage of your application.

jeancsanchez commented 7 years ago

The same thing happened to me. In my case, my layout had a default background image where I used to test. I just removed it and it worked.

ClaudeHangui commented 7 years ago

@ethanhua It's a default image which serves as a placeholder....When you mean I may be loading a larger bitmap, is there a recommended size for the bitmap ??

ethanhua commented 7 years ago

@ClaudeHangui @jeancsanchez How many times the crash occured ? and what kind of phone the crash happened? also you can see this: https://github.com/team-supercharge/ShimmerLayout/issues/25