public void onSubmitClick(View view) {
    String question = questionInput.getText().toString();
    boolean cancel = false;
    View focusView = null;

    if (question == "") {
      questionInput.setError("Required field");
      focusView = questionInput;
      cancel = true;
    }

    if (answerList.isEmpty()) {
      answerInput.setError("Answers needed");
      focusView = answerInput;
      cancel = true;
    }

    if (radioGroup.getCheckedRadioButtonId() == -1) {
      singleChoice.setError("Required input");
      focusView = radioGroup;
      cancel = true;
    }

    if (cancel) {
      focusView.requestFocus();
    } else {
      String[] answerListStrings =
          Arrays.copyOf(answerList.toArray(), answerList.size(), String[].class);
      survey.addQuestion(question, answerListStrings, multipleChoice.isChecked());
      currentQuestion++;
      Intent intent;
      Log.d(
          "current, number",
          String.valueOf(currentQuestion) + " " + String.valueOf(numberOfQuestions));
      if (currentQuestion >= numberOfQuestions) {
        Toast.makeText(this, "Question submitted", Toast.LENGTH_SHORT).show();
        intent = new Intent(this, MainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
      } else {
        Toast.makeText(this, "Question submitted", Toast.LENGTH_SHORT).show();
        intent = new Intent(this, NewSurveyQuestionsActivity.class);
        intent.putExtra("numberOfQuestions", numberOfQuestions);
        intent.putExtra("currentQuestion", currentQuestion);
        intent.putExtra("survey", survey);
        startActivity(intent);
      }
    }
  }