title: Android: converting String to int
body: <p>I'm simply trying to convert a string that is generated from a barcode scanner to an int so that I can manipulate it by taking getting the remainder to generate a set number of integers.  So far I have tried: </p>
  
  <pre><code>int myNum = 0;
  
  try {
      myNum = Integer.parseInt(myString.getText().toString());
  } catch(NumberFormatException nfe) {
  
  } 
  </code></pre>
  
  <p>and</p>
  
  <pre><code>Integer.valueOf(mystr);
  </code></pre>
  
  <p>and </p>
  
  <pre><code>int value = Integer.parseInt(string); 
  </code></pre>
  
  <p>The first one gives me the error :The method getText() is undefined for the type String
  while the last two don't have any compile errors but the app crashes immediately when those are called.  I thought it had to do with my barcode scanning intent method but I put it into the OnCreate and still got the error.</p>