Reputation: 355
I'm working with a Xamarin Forms app that uses a lot of button with images. So after some time of navigation my android app crash, beacuse of out of memory problem. How can I handle this problem?
Upvotes: 0
Views: 702
Reputation: 30022
You need to be very careful when dealing with images:
Before an image is displayed on the screen, it has to be loaded into the memory.
Let’s assume you have a brand new device with full HD screen and 12 MP camera. The picture you just took is 4000x3000 pixels large and the total memory needed to display it is: 4 bytes * 4000 * 3000 = 48 MB for a single image!
What you need to do is:
Above info from the below resources:
You can follow the same approaches using C# to resize the large images and display them efficiently.
Upvotes: 2