Skip to content

Instantly share code, notes, and snippets.

@musicalbigfoot
Created June 9, 2013 00:13
Show Gist options
  • Save musicalbigfoot/5737064 to your computer and use it in GitHub Desktop.
Save musicalbigfoot/5737064 to your computer and use it in GitHub Desktop.
Only inflate view if it doesnt exist
if (rootView != null) {
ViewGroup parent = (ViewGroup) rootView.getParent();
if (parent != null)
parent.removeView(rootView);
}
try {
rootView = inflater.inflate(tabLayout, container, false);
} catch (InflateException e) {
/* view is already there, just return view as it is */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment