WebBrowser.mp4
For using a Webview in your app you need to add this code as a java class to your project:
public class CustomWebViewClient extends WebViewClient{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}Then you need to initialize Webview in your activity:
webview = findViewById(R.id.web);
webview.setWebViewClient(new CustomWebViewClient());
WebSettings webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);Features include:
- History save and load using Shared Preferences
- Search engine
- Swipe refresh layout
For using swipe refresh layout you need to use this dependency from androidx libraries:
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"You also need to add this permission in AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />This Project was created using Android Studio 4.0 .
Gradle version: 6.1.1
If you have any idea that can improve project or is there any bugs that you've solved, submit it in Pull Requests or email me.