title: reading data from a textfile and displaying it on the textview
body: <p>i am trying to read data from a textfile "temp.txt" which is in my raw folder and displaying the contents of the file on the text view "text" whenever a button "button" is clicked, but my app crashes while doing so, there is quite a possibility that i am doing it in a wrong way because i am new to android and java programming. i am pasting the code here, any help will be appreciated </p>
  
  <p>case R.id.b:</p>
  
  <pre><code>        InputStream is = getResources().openRawResource(R.raw.temp);
          BufferedReader br = new BufferedReader(new InputStreamReader(is));
          try {
              string = br.readLine();
              while(string != null){
                  st = string;
              }
              text.setText(st);
  
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          break;
  </code></pre>
  
  <p>"st" and "string" are both string variables. i will be glad if anyone can point out at another simple method to do the same.</p>