I have approximate 100 images and i want to load it in image view. Somehow it crashes and showing me an error. How can i load more images into single image view in sequence. I also want to call some text after particular frames. Like after every 20 frames i want to show text. Any idea how can i do that?
java.lang.OutOfMemoryError: Failed to allocate a 2419212 byte allocation with 160148 free bytes and 156KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:726)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:547)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1014)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:3747)
at android.content.res.Resources.loadDrawable(Resources.java:3620)
at android.content.res.Resources.getDrawable(Resources.java:1852)
at android.graphics.drawable.AnimationDrawable.inflate(AnimationDrawable.java:319)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1150)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1063)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:3736)
at android.content.res.Resources.loadDrawable(Resources.java:3620)
at android.content.res.Resources.getDrawable(Resources.java:1852)
at android.support.v7.widget.ResourcesWrapper.getDrawable(ResourcesWrapper.java:133)
at android.content.Context.getDrawable(Context.java:408)
at android.view.View.setBackgroundResource(View.java:17228)
at android.support.v7.widget.AppCompatImageView.setBackgroundResource(AppCompatImageView.java:83)
at com.example.aakash.giftry.MainActivity.onCreate(MainActivity.java:22)
at android.app.Activity.performCreate(Activity.java:6289)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)