Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Android crash occuring for Xamarin.Forms.Platform.Android.ImageRenderer

$
0
0

After about 20 clicks through my application (which opens a new instance of the page and pops the previous pages to the root), the application crashes. According to what I am seeing in the Android log, this throws an unhandled exception of type Java.LangOutOfMemoryError. I've attached that log here.

After looking at a couple of other posts, I've come to the conclusion that it might be in the way that I am implementing my images, and disposing of the pages as I you navigate through the app (I'm using a Grid and instantiating the pages along with the menu graphics each time). I'm assuming that the PopToRootAsync isn't really coming along and calling the garbage collector to dispose of the resources, but I can't find a lot about that method in documentation that indicates when that happens.

Any suggestions? This has been plaguing our project for days now and I want to get to a stable build.

public async void DoDashboardClick()
{
var currentPage = this.Page;
DashboardPageBuilder page = new DashboardPageBuilder(Width, Height, this);
mDSRNavigation.NavigateTo(currentPage, page.GetPage(page.ViewModel));
}

Which in turn calls:

public static void NavigateTo(Page fromPage, Page toPage)
{
//Navigation switchboard to handle what page you are coming from and going to
NavigationRoot.PopToRootAsync();
NavigationRoot.PushAsync(toPage);
}

And builds the page:

public DashboardPageBuilder(float width, float height, BasePageViewModel baseModel)
: base(width, height, "Dashboard", true)
{
Width = width;
Height = height;
ViewModel = new DashBoardViewModel(baseModel, RereshDataTable);
HeaderViewModel = ViewModel;
BuildHeaderGrid();
_mStorePicker = mDSR.StyledObjects.AutoComplete("Start typing a store", 1000, ViewModel.StoresList, "SearchCommand",
"StoreSelectedCommand");
_mDatePicker = mDSR.StyledObjects.DatePicker("SearchDate", datePickHandler);
//_mDashboardLoader = new Image() {Source = loadingImage, Aspect = Aspect.AspectFit};
if (ViewModel.Stores.Selected != null)
{
_mStorePicker.TextEntry.Text = StoreService.GetUniqueStoreString(ViewModel.Stores.Selected);
_mStorePicker.ListViewSugestions.IsVisible = false;
}
GridHelper.NewRow().ColumnTracker.BuildColumns(3);
AddToGrid(_mDatePicker, GridHelper);
GridHelper.NewRow().AddToColumns(6);
AddToGrid(_mHeaderColumn.GetGrid(), GridHelper);
GridHelper.NewRows(4).ColumnTracker.BuildColumns(6);
_mTable = BuildTabledata();
_mTable.VerticalOptions = LayoutOptions.FillAndExpand;
AddToGrid(_mTable, GridHelper);
PageGrid.Children.Add(_mStorePicker, 3, 6, 1, 5);
BuildMenuGrid();
//PageGrid.Children.Add(_mDashboardLoader, 1, 5, 1, 5);
BuildTableSections();
}


Viewing all articles
Browse latest Browse all 58056

Trending Articles