@Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.unit_button:
       {
         OrgUnitDialogFragment fragment = OrgUnitDialogFragment.newInstance(this);
         fragment.show(getChildFragmentManager());
         break;
       }
     case R.id.dataset_button:
       {
         DataSetDialogFragment fragment =
             DataSetDialogFragment.newInstance(this, mState.getOrgUnitId());
         fragment.show(getChildFragmentManager());
         break;
       }
     case R.id.period_button:
       {
         PeriodDialogFragment fragment =
             PeriodDialogFragment.newInstance(this, mState.getDataSetId());
         fragment.show(getChildFragmentManager());
         break;
       }
     case R.id.data_entry_button:
       {
         // startReportEntryActivity();
         break;
       }
   }
 }
  private void startReportEntryActivity() {
    String orgUnitId = mState.getOrgUnitId();
    String orgUnitLabel = mState.getOrgUnitLabel();

    String dataSetId = mState.getDataSetId();
    String dataSetLabel = mState.getDataSetLabel();

    String period = mState.getPeriod().getDate();
    String periodLabel = mState.getPeriod().getLabel();

    Intent intent =
        ReportEntryActivity.newIntent(
            getActivity(), orgUnitId, orgUnitLabel, dataSetId, dataSetLabel, period, periodLabel);
    startActivity(intent);
  }
  public void onRestoreInstanceState() {
    AggregateReportFragmentState backedUpState = new AggregateReportFragmentState(mState);
    if (!backedUpState.isOrgUnitEmpty()) {
      onUnitSelected(backedUpState.getOrgUnitId(), backedUpState.getOrgUnitLabel());

      if (!backedUpState.isDataSetEmpty()) {
        onDataSetSelected(
            backedUpState.getDataSetId(),
            backedUpState.getDataSetLabel(),
            backedUpState.getDataSetCategoryComboId());

        if (!backedUpState.isPeriodEmpty()) {
          onPeriodSelected(backedUpState.getPeriod(), false);

          if (!backedUpState.areCategoryStatesEmpty()) {
            onCategoriesSelected(backedUpState.getCategoryStates());
          }
        }
      }
    }
  }