Code example for WebView

Methods: getUrl, documentAsText, externalRepresentation

0
        @Override 
        public void handleMessage(Message msg) {
            if (msg.what == MSG_TIMEOUT) {
                mTimedOut = true;
                if(mCallback != null)
                    mCallback.timedOut(mWebView.getUrl());
                requestWebKitData(); 
                return; 
            } else if (msg.what == MSG_WEBKIT_DATA) {
                TestShellActivity.this.dump(mTimedOut, (String)msg.obj);
                return; 
            } 
 
            super.handleMessage(msg);
        } 
    } 
 
    public void requestWebKitData() { 
        Message callback = mHandler.obtainMessage(MSG_WEBKIT_DATA);
 
        if (mRequestedWebKitData)
            throw new AssertionError("Requested webkit data twice: " + mWebView.getUrl());
 
        mRequestedWebKitData = true;
        switch (mDumpDataType) {
            case DUMP_AS_TEXT:
                mWebView.documentAsText(callback);
                break; 
            case EXT_REPR:
                mWebView.externalRepresentation(callback);
                break; 
            default: 
                finished(); 
                break; 
        }