I am running into an issue with image loading in Xamarin.Forms. I am loading images into a listview, then popping up a carousel with the images. None of them exceed 164KB. The heap is growing quickly, and crashing the emulator and slowing the device I have installed it on (I set largeHeap to true, but know this is a bandaid, not a solution). All of the solutions I have found have to do with Android-specific bitmap handling - do I need to implement Android specific image handlers?
The listview consist of cells with an image and label in a stacklayout, with the image bound:
var productImage = new Image
{
HeightRequest = 300
};
productImage.SetBinding(Image.SourceProperty,"ImageFileName");
The tap event launches a carousel with a contentpage, containing an image and a button, image as follows:
boundImage = new Image
{
HeightRequest = 350,
WidthRequest = 350,
HorizontalOptions = LayoutOptions.CenterAndExpand,
VerticalOptions = LayoutOptions.CenterAndExpand
};
boundImage.SetBinding (Image.SourceProperty, "ImageFileName");
Since the images are loaded on binding, I don't have control of usings and other such hints I have seen around.
Any help is much appreciated.