Skip to content

Instantly share code, notes, and snippets.

@larkintuckerllc
Last active November 27, 2017 01:14
Show Gist options
  • Save larkintuckerllc/0229cfac87c5e3620267c36fca3f1373 to your computer and use it in GitHub Desktop.
Save larkintuckerllc/0229cfac87c5e3620267c36fca3f1373 to your computer and use it in GitHub Desktop.
How-to Dagger 2 with Android: Part 1 - 11
...
public class MainActivity extends AppCompatActivity {
@Inject MyExample mMyExample;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView dateTextView = findViewById(R.id.tvDate);
((MyApplication) getApplication())
.getMyComponent()
.inject(MainActivity.this);
dateTextView.setText((new Date(mMyExample.getDate())).toString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment