Android: Live Logging - Programmatically log to a TextView

It is not always possible to test a application from your desk and you have to move around or even leave the office to test the GPS features. For operational reasons it is not possible to debug your app or even read Logcat entries then. But there is a solution for displaying your Logcat messages inside a Textview. First you need the following permissions for your app:
<uses-permission android:name="android.permission.READ_LOGS" />

Then you are able to add the following try-catch block into your activities onCreate() method to log to a given Textview:
try {

Process process = Runtime.getRuntime().exec("logcat -d");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));

StringBuilder log=new StringBuilder();
String line;

while ((line = bufferedReader.readLine()) != null) {
log.append(line);
}

TextView textViewLog = (TextView)findViewById(R.id.textViewLog);

textViewLog.setText(log.toString());

} catch (IOException e) {
}

You are able to modify the Logcat parameters. You can find all necessary information here in the documentation.