So, I have this application in Xamarin.Droid, which basically downloads the image downloaded from the resource, only 168 KB. Before downloading the image, the RAM consumption of the application is 29.81 MB (already too high, because at the moment I am downloading the image from xaml, which is 54 KB). When a 168 KB file is displayed, it switches to 60-80 MB!
Now I go to the next page, calling:
var modalPage = new SomeContentPage();
await Navigation.PushAsync(modalPage);
Then I load the list of objects from the json file with these lines:
Stream stream = assembly.GetManifestResourceStream(Constants.APP_NAMESPACE + ".someJson.json");
StreamReader re = new StreamReader(stream);
string content = re.ReadToEnd();
this._animals = JsonConvert.DeserializeObject<List<MyObject>>(content);
re.Dispose();
stream.Dispose();
deserialized using:
this._someList = JsonConvert.DeserializeObject<List<MyObjects>>(someJsonSource)
Depending on the "current position of the page." I assign it to the current object (of course imgBackground is an image):
imgBackground.Source = ImageSource.FromResource(Constants.APP_NAMESPACE + ".Resources." + someObject.ImageFileName);
The someObject list contains only 10 items with four string fields.
- ? ?