I am trying to make a function that will count how many lines starts with & in given file. So far i came up with following function
  public int CountNumberOfTexts(String filename)  {
        try{
            File file = new File(filename);
            if(file.exists()){
                FileReader fr = new FileReader(file);
                LineNumberReader lnr = new LineNumberReader(fr);
                int linenumber = 0;
                while (lnr.readLine() != null){
                    if (lnr.readLine().substring(0,1) == "&") {
                        linenumber++;
                    }
                }
                Log.d("Count", "NUMBER OF LINES: " + linenumber);
                lnr.close();
                return linenumber;
            }else{
                System.out.println("File does not exists: " + filename);
            }
        }catch(IOException e){
            e.printStackTrace();
        }
        return 0;
    }
Current Function error is: Not recognizing lines starting with & character.
 
     
    