FileDocCategorySizeDatePackage
LogViewer.javaAPI DocAndroid 1.5 API5217Wed May 06 22:41:08 BST 2009com.android.development

LogViewer

public class LogViewer extends android.app.Activity
Views the device log.

Fields Summary
static final String
TAG
FileOutputStream
logger
volatile boolean
active
android.os.Handler
handler
LogTextBox
text
Constructors Summary
Methods Summary
private voidappendThrowable(java.lang.Throwable t)

        StringBuilder builder = new StringBuilder();
        builder.append("Error reading log: ");
        builder.append(Log.getStackTraceString(t));
        text.getText().append(builder);
    
static intnext0(byte[] bytes, int start)

        for (int current = start; current < bytes.length; current++) {
            if (bytes[current] == 0)
                return current;
        }
        return bytes.length;
    
protected voidonCreate(android.os.Bundle icicle)


    
        
        super.onCreate(icicle);
        setContentView(R.layout.log_viewer);
        this.handler = new Handler();

        text = (LogTextBox) findViewById(R.id.text);

        text.setTextSize(10);
        text.setHorizontallyScrolling(true);
        text.setTypeface(Typeface.MONOSPACE);
        text.setGravity(Gravity.BOTTOM | Gravity.LEFT);

        this.active = true;
        try {
            logger = new FileOutputStream("/tmp/logviewer.txt");
            new Thread(new LogReader()).start();
        } catch (IOException e) {
            appendThrowable(e);
        }