Posts

Showing posts with the label Android - WebView Tutorial

Android - WebView Tutorial

Image
WebView is a view that display web pages inside your application. You can also specify HTML string and can show it inside your application using WebView. WebView makes turns your application to a web application. In order to add WebView to your application, you have to add  <WebView> element to your xml layout file. Its syntax is as follows − <WebView xmlns:android = "http://schemas.android.com/apk/res/android" android:id = "@+id/webview" android:layout_width = "fill_parent" android:layout_height = "fill_parent" /> In order to use it, you have to get a reference of this view in Java file. To get a reference, create an object of the class WebView. Its syntax is − WebView browser = (WebView) findViewById(R.id.webview); In order to load a web url into the WebView, you need to call a method loadUrl(String url)  of the WebView class, specifying the required url. Its syntax is: browser.loadUrl("http://www.tuto...