Move Dagger injection to method that is called later, to prevent NPE

This commit is contained in:
misaochan 2018-02-07 19:57:34 +10:00 committed by maskara
parent 119c4fb782
commit 94687090bd

View file

@ -70,7 +70,6 @@ public class PlaceRenderer extends Renderer<Place> {
*/
public PlaceRenderer(Fragment fragment) {
this.fragment = fragment;
((CommonsApplication) getContext().getApplicationContext()).injector().inject(this);
openedItems = new ArrayList<>();
}
@ -144,6 +143,7 @@ public class PlaceRenderer extends Renderer<Place> {
@Override
public void render() {
((CommonsApplication) getContext().getApplicationContext()).injector().inject(this);
place = getContent();
tvName.setText(place.name);
String descriptionText = place.getLongDescription();