README.md
1 Example: Android Activity Graphs
2 ================================
3
4 Building on top of the simple Android example, this example demonstrates how it is possible to
5 create child graphs for each activity which extend from the global graph.
6
7 Some 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
14 While this example only shows the presence of an activity scope, you should be able to see the
15 potential for other useful scopes that can be used. For example, having a dedicated object graph
16 for the current user session is a great way to manage data that is tied to the currently logged-in
17 user.
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