I have this in my layout :
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
This in my activity:
public class Shop extends Activity {
@Override protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
WebView webview;
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://www.example.co.uk/shop");
}
}
and this in the manifest:
<uses-permission android:name="android.permission.INTERNET" />
Yet when i run the application, i get a force close error and something about a null pointer in the log.. I’ve never used webview before so have no idea what i’m doing!
Add
setContentView(R.layout.your_layout);: