e.g. <WebView android:id="@+id/webView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"></WebView>
After create your instance inside the XML file, go to your main activity Java class. Above the @override declare your WebView so it can be used globally.
eg. WebView webview1;
Within the onCreate method add the following code.
webview1 = (WebView)findViewById(R.id.webView1);
webview1.loadUrl("http://whatever.com");
webview1.setwebViewClient(new webViewClient());
webview1.setWebChromeClient(new webChromeClient());
Hit launch and your app should be ready.
No comments:
Post a Comment