Reputation: 178
In a viewpager, i have added a view in 10 pages. My requirement is need to dispose unused view contents (ie) currently 1 view is displayed in viewpager and need to dispose unused 9 views contents. So i have override the Dispose() as like below.
protected override void Dispose(bool disposing)
{
DisposeContent();
base.Dispose(disposing);
}
But, the dispose() is not being called, when navigates to next page.
Can you please help me out how to dispose the unused view contents?
Upvotes: 0
Views: 1666
Reputation: 394
Dispose would only get called when you pop a page, when u move from one page to another, a forward navigation, the page is still alive and would be available in the navigation stack. When a page is removed (when performing back navigation) the page will get disposed.
Upvotes: 2