title: Crashing due to Integer.parseInt
body: <p>I'm trying to import text from a text file which has been generated in another <code>Activity</code>. The generated text file is made up of a <code>String</code> <code>ArrayList</code> which only contains numbers and the other random text generated by Android. When I import the text from the file I'm using a <code>BufferedReader</code> and <code>readLine()</code> to get each new number into an <code>Integer</code> <code>ArrayList</code>. I'm removing any non-numerical values from the text file and the numbers that are generated in the other Activity are split up by an "\n".</p>
  
  <p>The problem that I'm facing is that Android crashes when it loads the <code>Activity</code>. I've narrowed the cause down to <code>Integer.parseInt()</code>.</p>
  
  <p>My code is below:</p>
  
  <pre><code>ArrayList&lt;Integer&gt; lines = new ArrayList&lt;Integer&gt;();
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          File file = new File(getFilesDir(), "test_file.txt");
  
          try {
              BufferedReader br = new BufferedReader(new FileReader(file));
              while (br.readLine() != null) {
                  String text = (br.readLine()).replaceAll("[^0-9]+","").trim();
                  Integer number = Integer.parseInt(text);
                  lines.add(number);
              }
          } catch (IOException e) {
  
          }
  
          TextView tv = (TextView) findViewById(R.id.helptext);
  
          int max = 0, min = 100;
          double total = 0;
          for (int i = 0; i &lt; lines.size(); i++) {
              int number = lines.get(i);
              max = Math.max(max, number);
              min = Math.min(min, number);
              total += number;
          }
  
          tv.setText("max = " + max + " min = " + min + " total = "
                  + total);
  </code></pre>