Java tutorial
//package com.java2s; import android.os.Environment; import android.widget.TextView; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class Main { public static void readFromLog(int lines, TextView t) { File sdcard = new File(Environment.getExternalStorageDirectory() + "/clr_log.file"); //Read text from file StringBuilder text = new StringBuilder(); int n = 0; try { BufferedReader br = new BufferedReader(new FileReader(sdcard)); String line; while ((line = br.readLine()) != null && n <= lines) { text.append(line); text.append('\n'); n++; } } catch (IOException e) { e.printStackTrace(); } //Set the text t.setText(text); } }