title: Convert string inside an Object to int
body: <p>I have android/java convert question.</p>
  
  <p>I use onClick to take clicks on my imageViews and catch their tags (for example, android:tag="2"). After that, I need to convert that tag to int so that I can use it as a number to do some calculations.</p>
  
  <p>I am trying to do it in this way:</p>
  
  <pre><code>public void onClick(View v) {       
          Object viewID =  v.getTag();
          int id =  ((Integer)viewID).intValue();
  }
  </code></pre>
  
  <p>BUT, the problem is that I do not get int value inside my "id" variable. The error says: </p>
  
  <blockquote>
    <p>"java.lang.ClassCastException: java.lang.String cannot be cast to
    java.lang.Integer".</p>
  </blockquote>
  
  <p>Can you give me some other way to convert my tag inside "viewID" to int and put it inside "id"?</p>
  
  <p>I am new to android and I appreciate your help :)</p>