Questions about Android imageView (OOM Error).

Asked 1 years ago, Updated 1 years ago, 147 views

Hello. I'm leaving a question because there was a problem while developing the app.

I'm trying to process a large amount of images on one screen.

The image is jpg, and about 70 files with a capacity of 2 to 30 kb are attached.

It has an average resolution of 300x500.

Set to orientation="vertical" statically in XML and arrange vertically

You want to scroll to show the images.

There is a memory overrun error because I am showing a lot of images.

I googled and found that the simple way to do it is to use android:largeHeap="true" in Menifest I'm asking you to add it, but I can't solve this method.

Also, it runs on some smartphones, but the app dies on other smartphones.

Below is the error code, and the limited memory in the back was about 5 megabytes when it was first turned on

After that, it was reduced to one megabyte in that's how it was.

java.lang.OutOfMemoryError: 
Failed to allocate a 8103900 byte allocation with 1166400 free bytes and 1139KB until OOM 
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)

If you know anything about this or if you know a similar example, please reply.

Thank you for reading the long question. Have a good day!

android imageview

2022-09-22 15:06

2 Answers

http://d2.naver.com/helloworld/429368 I think it would be helpful to read this article.

There is no glide you used, but there is a similar content about Picasso.


2022-09-22 15:06

As a self-answer, we solved the problem by using the Glide library.


2022-09-22 15:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.