title: Switch - case expressions must be constant expressions, I can't make the if-else statment
body: <p><strong>This is a project of QR Code generation and this is the source of the code 
  <a href="http://www.mysamplecode.com/2012/09/android-generate-qr-code-using-zxing.html" rel="nofollow">That is the source</a>
  here an error of the constant case
  I know that it must put in If-else but I don't know how in this project anyone can help me ?!</strong></p>
  
  <pre><code>//That is a QR code generator project`enter code here`
      @Override
      public void onClick(View v) {
          // TODO Auto-generated method stub
          switch (v.getId()) {
            case R.id.button1://&lt;--- is the error .. I can't make it If-else statement
             EditText qrInput = (EditText) findViewById(R.id.QR);
             String qrInputText = qrInput.getText().toString();
             Log.v(LOG_TAG, qrInputText);
  
             //Find screen size
             WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE);
             Display display = manager.getDefaultDisplay();
             Point point = new Point();
             display.getSize(point);
             int width = point.x;
             int height = point.y;
             int smallerDimension = width &lt; height ? width : height;
             smallerDimension = smallerDimension * 3/4;
  
             //Encode with a QR Code image
             QREncoder qrCodeEncoder = new QREncoder(qrInputText, 
                       null, 
                       Contents.Type.TEXT,  
                       BarcodeFormat.QR_CODE.toString(), 
                       smallerDimension);
             try {
              Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();
              ImageView myImage = (ImageView) findViewById(R.id.imageView1);
              myImage.setImageBitmap(bitmap);
  
             } catch (WriterException e) {
              e.printStackTrace();
             }
  
  
             break;
  
             // More buttons go here (if any) ...
  
            }
           }
      }
  </code></pre>