title: Reading a text file line by line in android
body: <p>hi i just started learning android development and  i'm trying to build an app that reads text from files.
  i have been searching all over the internet but i don't seem to find the way to do so , so i have a few questions..</p>
  
  <p>1.how to do this?
   what is the preferred way to read a file line by line in android?</p>
  
  <p>2.where should i store the file?
   should it be in the raw folder or maybe in  the assets folder?</p>
  
  <p>so this is what i already tried: " (i think the problem may be with finding the file..)</p>
  
  <pre><code>@Override   
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.filereader);
  
      try {
          // open the file for reading
          InputStream fis = new FileInputStream("text.txt");
  
          // if file the available for reading
          if (fis != null) {
  
            // prepare the file for reading
            InputStreamReader chapterReader = new InputStreamReader(fis);
            BufferedReader buffreader = new BufferedReader(chapterReader);
  
            String line;
  
            // read every line of the file into the line-variable, on line at the time
            do {
               line = buffreader.readLine();
              // do something with the line 
               System.out.println(line);
            } while (line != null);
  
          }
          } catch (Exception e) {
              // print stack trace.
          } finally {
          // close the file.
          try {
              fis.close();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>