I have listview with many view elements,(especially many images). Each viewcell is consisted from text and images. All data for displaying I obtain from API, including string url for images..
Url for all images I obtain in full size and before displaying I must crop and resize this method:
private async Task<ImageSource> GetBytesFromUrl(string url, int width, int height) { HttpClient a = new HttpClient(); var p = await a.GetByteArrayAsync(url); var newByteArray = DependencyService.Get<IImageService>().CropCenterImage(p, width, height); var imRes = ImageSource.FromStream(() => new MemoryStream(newByteArray)); return imRes; }
1 problem:
I spend many time for invoke method GetBytesFromUrl
for each images. Each listview element can have up 8 photos.
2problem:
Problem with display images. I display only 8 images but also shown images from another item, how to solve this, maybe clean all images before display?
3 problem:
When I quick scroll many listview item with many photos, scrollview works very slow and freeze on 1-2 sec. I think this problem binding with 1 problem and amount of images
4 problem:
When I open page with listview photos, some images download by HttpClient
very long time.