Easy way to Implement WebView To Navigation Drawer Activity. Convert website to app. Load website in your application.
Watch this video :
1. Open the Project that was created in the previous video or create a new project, Check: How To Start A New Project On Android Studio .
2. Open content_main.XML file. Delete Hello World Text – Just click it and press delete.
3. Change layout then Drag and drop WebView for palette.
4. Give it an id.
5. Go to MainActivity.java file.
6. Implement Java codes.
Add this above onCreate method :
public WebView webView;
Paste this under onCreate :
webView= (WebView)findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://www.codeseasy.com");
7. Change the URL.
8. Go to Manifest.XML File, Give it permission for Internet.
<uses-permission android:name="android.permission.INTERNET" />
9. Build your APK. Done.
Thats all for Implementing WebView To Navigation Drawer Activity. On next post we would see how to add progress bar to your application.