java - How to use webview in Android xml? -
i have created layout.xml.
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <webview android:id="@+id/mwebview" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </linearlayout>
this in activity. m getting web-view can not resolved or not field , getting nullpointerexception.here code.
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); mwebview=(webview)findviewbyid(r.id.mwebview); new getcontactstask().execute(); }
change java code:
setcontentview(r.layout.layout) //true
instead of:
setcontentview(r.layout.main); //false
Comments
Post a Comment