implementing Android WebView

Hi In this tutorial i will give you instructions on implementing webview in Android. Sometimes you may need to load webpages inside your application itself rather than redirecting the user to browser. In this tutorial we will see the commands necessary to display webpages inside the application. First of all create a new project and compile it, Make sure you build.gradle file look similar to this

This application will need internet to download webpages, therefore add the internet permission to your manifest. Your manifest file must look similar to this.

Now Create a relative layout activity  and then add a web view inside the relative layout, your activity should look similar to this.

Then modify your mainActivity .java file, it should look similar to this. Look for the comments inside the code for explanation.

Now compile your project and run. You should be able to see a webpage loaded inside your webview. As shown Below.