Soru & Cevap

RecyclerView kasma

27.11.2018 - 01:51

Arkadaşlar merhaba, ben bir program yaptım, program gereği recyclerview ve drawable da onlarca resim kullandım, recyclerview e resimleri yüklüyor ancak program çalıştığında kasma yapıyor ve programı durdurup kapatıyor, resim sayısını azaltarak denedim ancak yine kasma yapıyor ama programı durdurmuyor, nedeni ne olabilir?

47 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

picture-199562-1543614110.jpg
tanyurd
01.12.2018 - 12:43

resim boyutlarının tesirini unutmayın. mb'ı aşan resimler kullanırsanız kaçınılmaz sondur. 

Anonim
02.12.2018 - 12:16
Mb olan hiçbir resim yok hepsi KB, aynı işlemi gridview de denedim ancak yine kastı, resmin sayısını azalttım biraz kasma olsada açılıyor, ancak resmin sayısı arttıkça program açılmıyor, sanırım tek çare veritabanı veya internet üzerinden çekmek :) verdiği hata; E/AndroidRuntime: FATAL EXCEPTION: main Process: com.info.cumamesajlari, PID: 10713 java.lang.OutOfMemoryError: Failed to allocate a 20183052 byte allocation with 2188976 free bytes and 2MB until OOM at dalvik.system.VMRuntime.newNonMovableArray(Native Method) at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:655) at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:483) at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1157) at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:720) at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:571) at android.content.res.Resources.getDrawable(Resources.java:879) at android.content.Context.getDrawable(Context.java:530) at android.widget.ImageView.resolveUri(ImageView.java:840) at android.widget.ImageView.setImageResource(ImageView.java:439) at com.info.cumamesajlari.ImageAdapter.getView(ImageAdapter.java:64) at android.widget.AbsListView.obtainView(AbsListView.java:2491) at android.widget.GridView.makeAndAddView(GridView.java:1444) at android.widget.GridView.makeRow(GridView.java:371) at android.widget.GridView.fillDown(GridView.java:312) at android.widget.GridView.fillFromTop(GridView.java:447) at android.widget.GridView.layoutChildren(GridView.java:1310) at android.widget.AbsListView.onLayout(AbsListView.java:2249) at android.view.View.layout(View.java:17844) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1189) at android.view.View.layout(View.java:17844) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:383) at android.widget.FrameLayout.onLayout(FrameLayout.java:321) at android.view.View.layout(View.java:17844) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1982) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1826) at android.widget.LinearLayout.onLayout(LinearLayout.java:1735) at android.view.View.layout(View.java:17844) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:383) at android.widget.FrameLayout.onLayout(FrameLayout.java:321) at android.view.View.layout(View.java:17844) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1982) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1826) at android.widget.LinearLayout.onLayout(LinearLayout.java:1735) at android.view.View.layout(View.java:17844) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:383) at android.widget.FrameLayout.onLayout(FrameLayout.java:321) at com.android.internal.policy.DecorView.onLayout(DecorView.java:751) at android.view.View.layout(View.java:17844) at android.view.ViewGroup.layout(ViewGroup.java:5754) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2711) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2384) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1462) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6965) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:907) at android.view.Choreographer.doCallbacks(Choreographer.java:709) at android.view.Choreographer.doFrame(Choreographer.java:644) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:893) at android.os.Handler.handleCallback(Handler.java:836) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:203) at android.app.ActivityThread.main(ActivityThread.java:6251) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)