WebView on android, hide address bar and work

0

I need to open a web in a WebView without the address bar but I have two problems.

  
  • The web opens perfectly, but clicking on a link leaves a blank screen, that is, I can not navigate.

  •   
  • If I rotate the device, it reloads the main page automatically.

  •   

    My code is as follows:

    String url="https://miejemplo.com";
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        WebView view = (WebView) findViewById(R.id.view);
        view.getSettings().setJavaScriptEnabled(true);
        view.setWebViewClient(new MyWebViewClient());
        view.loadUrl(url);
    }
    
    
    private class MyWebViewClient extends WebViewClient{
    
         public boolean shouldOverrideUrLoading(WebView view, String url){
            view.loadUrl(url);
             return true; //permite que la página se refresque en el webview
                }
    }
    

    Thanks

    I HAVE SOLVED IT IN THE FOLLOWING WAY:

    To send a restart activity when you rotate the device, add the following in the AndroidManifest.xml manifest:

    android: configChanges="orientation | screenSize"

    So it would be like this:

        
    asked by Fran Pino 25.09.2018 в 10:47
    source

    0 answers