fix app crash

This commit is contained in:
Milos Kozak 2017-05-16 20:02:09 +02:00
parent 91fa355d8c
commit 3ec08ab10f

View file

@ -33,24 +33,18 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
TextView treatmentsTab;
TextView tempBasalsTab;
Fragment bolusFragment;
Fragment tempBasalsFragment;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.treatments_fragment, container, false);
bolusFragment = new TreatmentsBolusFragment();
tempBasalsFragment = new TreatmentsTempBasalsFragment();
treatmentsTab = (TextView) view.findViewById(R.id.treatments_treatments);
tempBasalsTab = (TextView) view.findViewById(R.id.treatments_tempbasals);
treatmentsTab.setOnClickListener(this);
tempBasalsTab.setOnClickListener(this);
context = getContext();
setFragment(bolusFragment);
setFragment(new TreatmentsBolusFragment());
return view;
}
@ -60,10 +54,10 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
switch (v.getId()) {
case R.id.treatments_treatments:
setFragment(bolusFragment);
setFragment(new TreatmentsBolusFragment());
break;
case R.id.treatments_tempbasals:
setFragment(tempBasalsFragment);
setFragment(new TreatmentsTempBasalsFragment());
break;
}