Can't read lines from a text file
<p>I have a method like this:</p>

<pre><code>    public int getIncrement() {

    String extractFolder = "/mnt/sdcard/MyFolder";
    boolean newFolder = new File(extractFolder).mkdir();
    int counter = 0; 

    try {
        File root = new File(extractFolder); 
        if (root.canWrite()){
            File gpxfile = new File(root, "gpxfile.txt");
            FileWriter gpxwriter = new FileWriter(gpxfile);
            BufferedWriter out = new BufferedWriter(gpxwriter);

            Scanner scanner = new Scanner(new FileInputStream(gpxfile.getAbsolutePath()), "UTF-8");
            Log.i("PATH: ", extractFolder + "/gpxfile.txt");

           while(scanner.hasNextLine()) {
               String inc = scanner.nextLine(); 
               counter = Integer.parseInt(inc);
               Log.i("INSIDE WHILE: ", Integer.toString(counter)); 
           }
            counter++;
            out.write(Integer.toString(counter));
            out.close();
        }
    } catch (IOException e) {
        Log.e("GEN_PCN: ", "Could not write file " + e.getMessage());
    }
    return counter;  
}
</code></pre>

<p>What I am trying to accomplish is returning the content of this file, and increment the <code>integer</code> by 1. But it seems that I can't get in the <code>while</code> loop, because <code>LogCat</code> doesn't print out anything. Yes, am sure that the path is correct. </p>
