title: android read file from assets in real time
body: <p>I want to read last line of a text file from assets and get a new data I just add, so I try using handler but still got the same result.</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      handler = new Handler();
      handler.postDelayed(runnable, 5000);
  }
  
  private Runnable runnable = new Runnable() {
      @Override
      public void run() {
          try {
              String lastLine = "";
              Context context = getApplicationContext();
  
              BufferedReader br = new BufferedReader(new InputStreamReader(context.getAssets().open("kinect_gesture.txt")));
              String sCurrentLine;
  
              while ((sCurrentLine = br.readLine()) != null) {
                  System.out.println(sCurrentLine);
                  lastLine = sCurrentLine;
              }
  
              TextView txt = (TextView)findViewById(R.id.gesture);
              txt.setText(lastLine);
          }catch( java.io.FileNotFoundException e ) {
              e.printStackTrace();
          } catch( java.io.IOException e ) {
              e.printStackTrace();
          }
  
          handler.postDelayed(this, 5000);
      }
  };
  </code></pre>
  
  <p>Is there a way to get new data from text file while running app?</p>