NullPointerException
NullPointerException

Reputation: 37701

How to free the memory of a Layout and all his children views?

I have some huge layouts which I need to free from the memory in some cases, and these layouts have a lot of children.

Which is the best way to achieve it?

I can't find the way on Google.

Upvotes: 0

Views: 870

Answers (1)

Akhil
Akhil

Reputation: 14058

Assign id to your layout, get a reference to it and call removeAllViews(); to remove all its child view. If l1 is my LinearLayout, then l1. removeAllViews();

Upvotes: 2

Related Questions