title: showing a dialog box based on a if/else statement
body: <p>I have a very simple method where if the number of click counts equal 4, 8, 12 then output relevant messages, else for every 4th number output a general message. This is all displayed within a dialog but what I notice is the else statement appears for every increase of the click count by one. I am not sure why that is?</p>
  
  <p>What I also don't get is every time the dialog box appears, it takes more attempts to dismiss it. For example when it opens first time I click on the ok button once and it closes. When it opens the second time it takes 2 clicks of ok to close it. £ times equals 3 times and etc.</p>
  
  <pre><code>        selectAnotherButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  getClickCountInt++;
  
                  if (getClickCountInt == 4){
                      ShowRewardDialog("You are rewarded with a the yellow smiley face in the homepage");
                  } else if (getClickCountInt == 8) {
                      ShowRewardDialog("You are rewarded with a the green smiley face in the homepage");
                   } else if (getClickCountInt == 12) {
                      ShowRewardDialog("You are rewarded with a the red smiley face in the homepage");
                   } else {
                      for(int i = 0; i &lt;= getClickCountInt; i+=4) {
                      ShowRewardDialog("You are rewarded with a video\"");
                      }
                  }
              }
          });
  
   private void ShowRewardDialog(String message) {
  
          final Dialog dialog = new Dialog(Content.this);
          dialog.setContentView(R.layout.custom_dialog);
  
          SpannableString title = new SpannableString("YOU GAINED A REWARD");
  
          title.setSpan(new ForegroundColorSpan(Content.this.getResources().getColor(R.color.purple))
                  , 0, title.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
  
          // set the custom dialog components - text, image and button
          TextView text = dialog.findViewById(R.id.dialog_text);
          dialog.setTitle(title);
  
          text.setText(message);
  
          Button dialogButton = dialog.findViewById(R.id.dialog_button_OK);
          // if button is clicked, close the custom dialog
          dialogButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  dialog.dismiss();
              }
          });
  
          dialog.show();
      }
  }
  </code></pre>