README.md
1Example: Android Activity Graphs
2================================
3
4Building on top of the simple Android example, this example demonstrates how it is possible to
5create child graphs for each activity which extend from the global graph.
6
7Some of the advantages of the activity scope:
8
9 * Provides the ability to inject objects which require the activity to be constructed.
10 * Allows for the use of singletons on a per-activity basis. This is a great way to manage a
11 resource that is shared by a bunch of fragments in an activity.
12 * Keeps the global object graph clear of things that can be used only by activities.
13
14While this example only shows the presence of an activity scope, you should be able to see the
15potential for other useful scopes that can be used. For example, having a dedicated object graph
16for the current user session is a great way to manage data that is tied to the currently logged-in
17user.
18
19_Note: The app does not actually do anything when it is run. It is only to show how you can
20 structure Dagger within an Android app_
21
22_Note: The app is in transition to Dagger 2 and may not reflect recommended patterns. Before
23 we release Dagger 2.0 it will, but until this note is removed, please do not rely on this
24 example as a strong recommendation._
25