dimanche 24 juillet 2016

LoadURL in WebViewFragment from another class?

I have a class which extends WebViewFragment and what I want to achieve is to be able to load other URL from another class into this WebViewFragment class. Here is how my code looks like:

public class FragWeber extends WebViewFragment {

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

        WebView webView = getWebView();
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);

        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl("https://www.google.com");
    }
}

Any idea how to access the WebView to load other URL?

Aucun commentaire:

Enregistrer un commentaire