I've realized when using a tab layout in Android it always loads the tabs touching it, i.e. the tab before and the tab after so it is loaded when you page to it.
However, I load lots of content and images from a server and this causes a lot of data and memory use and I often get OOM errors
, I am displaying the images efficiently using Glide.
Basically I need to know 3 things:
- How can I stop the tab layout loading any pages other than the current one
- How to
clear/recycle/delete
an old tab after you get to a new page to clear up memory - How to always refresh the tab when you go back to it