Android WebView error -



Android WebView error -

i'm beginner in learning android, please help me this. maintain getting error:

02-19 16:55:00.330: e/androidruntime(2335): java.lang.runtimeexception: unable start activity componentinfo{com.mkyong.android/com.mkyong.android.webviewactivity}: java.lang.nullpointerexception

public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.webview); webview mywebview = (webview) findviewbyid(r.id.webview1); webview.getsettings().setjavascriptenabled(true); websettings websettings = mywebview.getsettings(); mywebview.loadurl("http://www.google.com"); }

my xml file:

<webview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webview1" android:layout_width="fill_parent" android:layout_height="fill_parent" />

i think it's line

webview.getsettings().setjavascriptenabled(true);

you never webview is. declare mywebview, not webview

android webview

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -