private void cleanupAndFinish(int result) {

    SurveyStateHolder.reset();
    Intent returnIntent = new Intent();
    setResult(result, returnIntent);
    finish();
  }
  public void onResume() {
    super.onResume();

    SurveyType st = SurveyStateHolder.getCurrentSurveyType();
    if (SurveyStateHolder.hasQuestion()) {
      Question q = SurveyStateHolder.getNextQuestion();
      if (q.getAnsType() == AnswerType.NUMBER) {
        Intent i = new Intent(this, NumberQuestionActivity.class);
        startActivityForResult(i, 2);
      } else if (q.getAnsType() == AnswerType.TEXT) {
        Intent i = new Intent(this, TextQuestionActivity.class);
        startActivityForResult(i, 2);
      } else if (q.getAnsType() == AnswerType.RADIOGROUP) {
        Intent i = new Intent(this, RadioGroupQuestionActivity.class);
        startActivityForResult(i, 2);
      } else if (q.getAnsType() == AnswerType.COUNT) {
        Intent i = new Intent(this, CountActivity.class);
        startActivityForResult(i, 2);
      }
    } else {
      cleanupAndFinish(RESULT_OK);
    }
  }