Simple switch statement with the next button as a final case. I want it so the user must select an image in the switch statement before moving on. I have no idea how to write something to stop them user just clicking the next button and moving onto the next activity without making a selection from the switch statement. Code below.
    public void onClick(View v) {
    SharedPreferences.Editor editorWorkout = workoutPref.edit();
    // get the constraint layout from its ID.
    ConstraintLayout mConstraintLayout = getView().findViewById(R.id.FragmentWorkoutMood1);
    switch (v.getId()) {
        case R.id.excitedFace:
            mConstraintLayout.setBackgroundResource(R.mipmap.background_clouds_excited);
            editorWorkout.putInt("excitedkey", EXCITED.getId());
            editorWorkout.commit();
            break;
        case R.id.happyFace:
            mConstraintLayout.setBackgroundResource(R.mipmap.background_clouds_happy);
            editorWorkout.putInt("happykey", HAPPY.getId());
            editorWorkout.commit();
            break;
        case R.id.fineFace:
                 mConstraintLayout.setBackgroundResource(R.mipmap.background_clouds_fine);
            editorWorkout.putInt("finekey", FINE.getId());
            editorWorkout.commit();
            break;
        case R.id.nextBtnMoodPage:
            Intent intent = new Intent(getActivity(),   WorkoutAutomaticThoughtActivity.class);
            startActivity(intent);
    }
 
     
     
    