But even better: Loaders don’t stay around forever.
The examples here just passed in a Context, but you can certainly pass in any required classes (or mocks thereof! Being entirely event driven, it is also possible to determine exactly what state the Loader is in at any time as well as expose additional state solely for testing.
Note: while there’s a Loader Test Case designed for framework classes, you’ll need to make a Support Library equivalent from the Loader Test Case source code if you want to do something similar with the Support v4 Loader (something Nicholas Pike already has done! This also gives you a good idea of how to interact with a Now, it is important to mention that Loaders are reactive, recipients of data.
But I hope we’ve all moved beyond loading data on the UI thread (#perfmatters or something like that).
That discussion can go on for seasons and seasons, but let’s focus in on one case: loading data specifically for display in your Activity or Fragment with Loaders.
If Android destroys your fragments or activities, the You might need the ID for further method calls.