Android Performance — Lazy inflating Fragment with ViewStub
Raymond Chan
51
Nice solution — it doesn’t handle correctly orientation change or recreation from the back stack.
I added this to my fragment so it will be reinflated when needed
public void onDetach() {
super.onDetach();
wasInflated = false;
}