title: How to count lines in file txt android
body: <p>Can't understand how to count lines. Here is my code.</p>
  
  <pre><code> void load() throws IOException        
  {        
      File sdcard = Environment.getExternalStorageDirectory();
      File file = new File(sdcard,"agenda.file");
      StringBuilder text = new StringBuilder();
  
      try {
          BufferedReader br = new BufferedReader(new FileReader(file));
          String line;
  
          while ((line = br.readLine()) != null) {
              text.append(line);
              text.append('\n');
  
             TextView te=(TextView)findViewById(R.id.textView1);
  
          }
  
  
      }
      catch (IOException e) {
          //You'll need to add proper error handling here
      }
      Button monpopb = (Button) findViewById(R.id.button13);
      monpopb.setText(text);  
  </code></pre>
  
  <p>}
  So, how to count and settext in TextView? Thank you!    </p>