title: Clear imageview on the onClick event of alertDialog
body: <p>I want to clear imageview on the onClick event of alertDialog. Im passing index of integer value  to Show_Alert method to like below. IMGS is imageView Array. there are 8 images in that array.</p>
  
  <pre><code>Show_Alert("Confirm", "Do you want to Delete this",true, true,1);
  </code></pre>
  
  <p>But the error is </p>
  
  <blockquote>
    <p>"Cannot refer to a non-final variable option inside an inner class
    defined in a different method"</p>
  </blockquote>
  
  <p>so I create a final int option variable</p>
  
  <pre><code>final int option; 
  option=opt;
  </code></pre>
  
  <p>But it not work as expected. Need some help.</p>
  
  <p>This is my Show_alert method</p>
  
  <pre><code>private void Show_Alert(String title, String message,boolean okButton, boolean cancelButton,int opt)
          {
              final int option; 
              option=opt;
              AlertDialog.Builder alertDialog = new AlertDialog.Builder(capture_details.this);
              alertDialog.setTitle(title);
              alertDialog.setMessage(message);
  
              if(cancelButton==true)
              {
                  alertDialog.setNegativeButton("Cancel",
                          new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int which) {
                          dialog.cancel();
                      }
                  });
              }
  
              if(okButton==true &amp;&amp; option!=-1)
              {
  
                  alertDialog.setPositiveButton("Ok",new DialogInterface.OnClickListener() {
  
                      @SuppressLint("NewApi")
                      public void onClick(DialogInterface dialog, int which) {
                          if(option==1)
                          {
                              IMGS[option].setImageResource(R.drawable.image1);
                              IMGS[option].setScaleType(ImageView.ScaleType.CENTER_INSIDE) ;
                              IMGS[option].setTag(null);
                          }
  
                      }
                  });
  
              }
              else if(okButton==true)
              {
                  alertDialog.setPositiveButton("Ok",new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int which) {
  
  
                      }
                  });
  
              }
              // Showing Alert Message
              alertDialog.show();
          }
  </code></pre>