Homepage
Sign in / Sign up
Go to the profile of Noa Drach
Noa Drach
Aug 24, 2016
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;
 }

  • Go to the profile of Noa Drach

    Noa Drach

    • Share
    Go to the profile of Noa Drach
    Never miss a story from Noa Drach, when you sign up for Medium. Learn more
    Never miss a story from Noa Drach