public void startReading ( ) { logcat . setListener ( new Logcat . Listener ( ) { @ Override public void onTraceRead ( String logcatTrace ) { try { addTraceToTheBuffer ( logcatTrace ) ; } catch ( IllegalTraceException e ) { return ; } notifyNewTraces ( ) ; } } ) ; boolean logcatWasNotStarted = Thread . State . NEW . equals ( logcat . getState ( ) ) ; if ( logcatWasNotStarted ) { logcat . start ( ) ; } }
Configures a Logcat . Listener and initialize Logcat dependency to read traces from the OS log .