Android:java.lang.OutOfMemoryError: Failed to allocate a 23970828 byte allocation with 2097152 free bytes and 2MB until OOM

前端 未结 30 2609
暗喜
暗喜 2020-11-21 07:33

I want to show the Bitmap image in ImageView from sd card which is stored already. After run my application is crash and getting Ou

30条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-21 08:05

    I'm a newbie in android developing but I hope my solution helps, it works on my condition perfectly. Im using Imageview and set it's background to "src" because im trying to make a frame animation. I got the same error but when I tried to code this it worked

    int ImageID = this.Resources.GetIdentifier(questionPlay[index].Image.ToLower(), "anim", PackageName);
                imgView.SetImageResource(ImageID);
                AnimationDrawable animation = (AnimationDrawable)imgView.Drawable;
                animation.Start();
                animation.Dispose();
    

提交回复
热议问题