O'Reilly logo
  • Hoang Dung Nguyen thinks this is interesting:

Notice that you check to see whether getActivity() is null before setting the adapter. Remember that fragments can exist unattached from any activity

From

Cover of Android Programming: The Big Nerd Ranch Guide

Note

Check if a fragment is still attached