Skip to content

Latest commit

 

History

History
47 lines (42 loc) · 1.35 KB

File metadata and controls

47 lines (42 loc) · 1.35 KB

Android WebBrowser

Preview

WebBrowser.mp4

How to use

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

Features include:

  • History save and load using Shared Preferences
  • Search engine
  • Swipe refresh layout

Dependencies

For using swipe refresh layout you need to use this dependency from androidx libraries:

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"

Manifest

You also need to add this permission in AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />

Software

This Project was created using Android Studio 4.0 .
Gradle version: 6.1.1

Extras

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.