Closure of application [closed]

1

When I add this part of the code the application is closed, the code works because I have it in another application which can be the error

WebView view = (WebView) this .findViewById (R.id.webView); view.getSettings (). setJavaScriptEnabled (true); view.setWebViewClient (new MyBrowser ()); view.loadUrl ("http://www.google.es"); view.getSettings().setBuiltInZoomControls(true); view.setInitialScale(80);

    
asked by jorje garcia 05.09.2016 в 05:24
source

2 answers

2

Fixed the problem was that being a Fragment the code was different

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View v=inflater.inflate(R.layout.fragment_blank, container, false);
        mWebView = (WebView) v.findViewById(R.id.webView);
        mWebView.loadUrl("http://www.google.es");

        WebSettings webSettings = mWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setBuiltInZoomControls(true);
        mWebView.setInitialScale(80);

        mWebView.setWebViewClient(new WebViewClient());

        return v;
    }
    
answered by 05.09.2016 / 06:51
source
0

Maybe you have not added in the internet permission in the manifest

<uses-permission android:name="android.permission.INTERNET" />
    
answered by 05.09.2016 в 06:11