javascript on android
<p>Hi I need to get the height of page "http://www.android.com". So why I inject javascript into android . But I have an error in the execution. Can any person to help me.</p>

<p>Code </p>

<pre><code>package com.load.page_html;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;



public class Main extends Activity {
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        final WebView webview = (WebView)findViewById(R.id.share_to_twitter_webView);
        /* JavaScript must be enabled if you want it to work, obviously */
        webview.getSettings().setJavaScriptEnabled(true);

        /* WebViewClient must be set BEFORE calling loadUrl! */
        webview.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url)
            {
                webview.loadUrl("javascript:(function() { if (document.body &amp;&amp; document.body.offsetHeight) " +
                        "return document.body.offsetHeight; " +  "})()");
            }
        });

        webview.loadUrl("http://www.android.com");



        }
}
</code></pre>

<p>The Error</p>

<pre><code>  03-18 14:50:31.679: ERROR/AndroidRuntime(462): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.load.page_html/com.load.page_html.Main}: java.lang.NullPointerException
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at android.os.Looper.loop(Looper.java:123)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at android.app.ActivityThread.main(ActivityThread.java:4363)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at java.lang.reflect.Method.invokeNative(Native Method)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at java.lang.reflect.Method.invoke(Method.java:521)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at dalvik.system.NativeStart.main(Native Method)
03-18 14:50:31.679: ERROR/AndroidRuntime(462): Caused by: java.lang.NullPointerException
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at com.load.page_html.Main.onCreate(Main.java:16)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-18 14:50:31.679: ERROR/AndroidRuntime(462):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
</code></pre>
