Webview弹出窗口故障

问题描述 投票:0回答:1

我创建了一个WebView应用程序,该应用程序应根据要求打开一个新的WebView弹出窗口。第一次尝试即可正常运作,但在病房结束后,应用程式当机。该应用程序在第二次尝试调用新窗口时崩溃,并且我不断收到以下错误消息

我的Logcat

2019-10-13 10:43:05.581 8309-8309/com.app.myApp E/AndroidRuntime: FATAL EXCEPTION: main Process: com.app.myApp, PID: 8309
    java.lang.IllegalArgumentException: New WebView for popup window must not have been  previously navigated.
        at kQ.handleMessage(PG:9)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7116)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)

My MainActivity.java

webView.setWebChromeClient(new WebChromeClient() {

            private WebView newWebView = new WebView(c);

            @Override
            public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {

                newWebView.setWebViewClient(new WebActivityClient(c) {
                                                @Override
                                                public void onPageStarted(WebView view, String url, Bitmap favicon) {
                                                    Intent intent = new Intent(c,PopupActivity.class);
                                                    intent.putExtra("URL", url);
                                                    startActivity(intent);
                                                }
                                            });
                WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
                transport.setWebView(newWebView);
                resultMsg.sendToTarget();
                        return true;
                    }
                });
    }
    private class WebActivityClient extends WebViewClient{
        public WebActivityClient(Context c) {
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view,String url){
            view.loadUrl(url);
            return true;
        }
    }

My PopActivity.java

public class PopupActivity extends HomeActivity {

    private WebView newWebview;
    private FrameLayout mWebContainer;
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_popup);
        final WebView newWebView = findViewById(R.id.webview_hidden);
        WebSettings newWebSettings = newWebView.getSettings();
        newWebSettings.setJavaScriptEnabled(true);
        newWebSettings.setBuiltInZoomControls(true);
        newWebSettings.setSupportZoom(true);
        newWebSettings.setPluginState(WebSettings.PluginState.ON);
        newWebSettings.setJavaScriptCanOpenWindowsAutomatically(true);
        newWebSettings.setAllowFileAccess(true);
        newWebSettings.setAllowFileAccess(true);
        newWebSettings.setAllowContentAccess(true);
        newWebSettings.setDomStorageEnabled(true);
        newWebSettings.setSupportMultipleWindows(true);

        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);

        int width = dm.widthPixels;
        int height = dm.heightPixels;

        getWindow().setLayout((int) (width*.9),(int) (height*.8));
        Intent intent = getIntent();
        String url = intent.getStringExtra("URL");

        newWebview = findViewById(R.id.webview_hidden);
        newWebview.loadUrl(url);
    }
    @Override
    protected void onDestroy(){
        super.onDestroy();
        if (newWebview != null) {
            newWebview.onPause();
            newWebview.destroy();
        }
    }
    @Override
    public void onBackPressed() {
        if (newWebview.canGoBack()) {
            newWebview.goBack();
        } else {
            super.onBackPressed();
        }
    }
   }

设备日志

2019-10-16 22:06:57.782 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:06:57.817 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:00.203 2173-2188/com.android.systemui I/ndroid.systemu: Background young concurrent copying GC freed 99380(3747KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 5773KB/9588KB, paused 3.839ms total 179.995ms
2019-10-16 22:07:00.205 2173-2188/com.android.systemui W/ndroid.systemu: Reducing the number of considered missed Gc histogram windows from 552 to 100
2019-10-16 22:07:01.608 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:01.676 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:01.765 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:01.774 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:01.873 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:01.886 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:03.011 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:03.063 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:06.604 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:06.680 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:06.790 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:06.823 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:06.917 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:06.924 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:07.505 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:07.545 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:07.966 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:08.012 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:11.728 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:11.818 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:11.879 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:11.888 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:11.965 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:11.977 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:12.986 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:13.052 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:16.804 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:16.915 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:16.995 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:17.024 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:17.127 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:17.135 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:17.227 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:17.239 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:17.620 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:17.666 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:18.249 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:18.305 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:21.746 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:21.830 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:21.937 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:21.945 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:23.028 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:23.080 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:25.358 2659-3769/com.google.android.gms.persistent E/NetworkScheduler.ATC: Trying to release unacquired lock: com.google.android.gms/.clearcut.uploader.QosUploaderService
2019-10-16 22:07:25.431 1986-2015/system_process E/memtrack: Couldn't load memtrack module
2019-10-16 22:07:25.433 1986-2015/system_process W/android.os.Debug: failed to get memory consumption info: -1
2019-10-16 22:07:25.484 1986-2015/system_process E/memtrack: Couldn't load memtrack module
2019-10-16 22:07:25.484 1986-2015/system_process W/android.os.Debug: failed to get memory consumption info: -1
2019-10-16 22:07:25.547 1986-2015/system_process E/memtrack: Couldn't load memtrack module
2019-10-16 22:07:25.547 1986-2015/system_process W/android.os.Debug: failed to get memory consumption info: -1
2019-10-16 22:07:25.611 1986-2015/system_process E/memtrack: Couldn't load memtrack module
2019-10-16 22:07:25.612 1986-2015/system_process W/android.os.Debug: failed to get memory consumption info: -1
2019-10-16 22:07:26.201 1986-2278/system_process W/system_server: JNI critical lock held for 17.180ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:26.284 1986-2278/system_process W/system_server: JNI critical lock held for 17.518ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:26.522 1986-2278/system_process W/system_server: JNI critical lock held for 18.729ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:26.703 1986-2278/system_process W/system_server: JNI critical lock held for 20.086ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:27.021 1986-2278/system_process W/system_server: JNI critical lock held for 19.255ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:27.119 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:27.217 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:27.357 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:27.405 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:27.534 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:27.555 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:27.602 1986-2278/system_process W/system_server: JNI critical lock held for 20.319ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:28.008 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:28.065 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:28.322 1986-2278/system_process W/system_server: JNI critical lock held for 20.245ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:28.383 1986-2278/system_process W/system_server: JNI critical lock held for 19.913ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:28.455 1986-2278/system_process W/system_server: JNI critical lock held for 21.782ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:28.488 1986-2278/system_process W/system_server: JNI critical lock held for 20.099ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:28.519 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:28.520 1986-2278/system_process W/system_server: JNI critical lock held for 17.910ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:28.570 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:28.759 15015-15173/com.google.android.gms I/EventLogChimeraService: Aggregate from 1571261804363 (log), 1571261804363 (data)
2019-10-16 22:07:29.405 1986-2278/system_process D/WificondControl: Scan result ready event
2019-10-16 22:07:32.342 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:32.448 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:32.516 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:32.530 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:33.377 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:33.433 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:37.199 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:37.322 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:37.418 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:37.469 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:37.538 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:37.546 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:38.008 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:38.040 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:38.495 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:38.541 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:40.962 1747-1747/? E/netmgr: Failed to open QEMU pipe 'qemud:network': Invalid argument
2019-10-16 22:07:40.984 1747-1747/? E/netmgr: WifiForwarder unable to open QEMU pipe: Invalid argument
2019-10-16 22:07:42.303 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:42.367 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:42.449 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:42.462 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:42.590 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:42.603 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:43.372 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:43.420 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:45.166 1986-6630/system_process I/DropBoxManagerService: add tag=event_data isTagEnabled=true flags=0x2
2019-10-16 22:07:45.190 1986-2016/system_process W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
2019-10-16 22:07:45.193 1986-2016/system_process W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
2019-10-16 22:07:45.602 15015-15185/com.google.android.gms W/gle.android.gm: JNI critical lock held for 19.790ms on Thread[34,tid=15185,Runnable,Thread*=0xd720f600,peer=0x12e00f28,"highpool[2]"]
2019-10-16 22:07:45.772 1986-2278/system_process W/system_server: JNI critical lock held for 20.979ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:45.832 1986-2278/system_process W/system_server: JNI critical lock held for 20.448ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:45.851 1986-2278/system_process W/system_server: JNI critical lock held for 19.073ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:46.061 1986-2278/system_process W/system_server: JNI critical lock held for 17.871ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:46.311 1986-2278/system_process W/system_server: JNI critical lock held for 19.143ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:46.332 1986-2278/system_process W/system_server: JNI critical lock held for 19.752ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:46.421 1986-2278/system_process W/system_server: JNI critical lock held for 19.803ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:46.846 1986-2278/system_process W/system_server: JNI critical lock held for 20.521ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:47.432 1986-2278/system_process W/system_server: JNI critical lock held for 20.329ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:47.502 1986-2278/system_process W/system_server: JNI critical lock held for 19.801ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:47.536 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:47.632 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:47.700 1986-2278/system_process W/system_server: JNI critical lock held for 19.925ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:47.755 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:47.788 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:47.854 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:47.864 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:48.070 1986-2278/system_process W/system_server: JNI critical lock held for 18.903ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:48.400 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:48.451 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:48.567 1986-2020/system_process E/BluetoothAdapter: Bluetooth binder is null
2019-10-16 22:07:48.601 1986-2278/system_process W/system_server: JNI critical lock held for 18.975ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:48.699 1986-2020/system_process E/KernelCpuSpeedReader: Failed to read cpu-freq: /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state: open failed: ENOENT (No such file or directory)
2019-10-16 22:07:48.839 1614-1811/? I/netd: tetherGetStats() <3.91363ms>
2019-10-16 22:07:49.157 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:49.166 1986-2278/system_process W/system_server: JNI critical lock held for 30.017ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:49.221 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:49.695 1614-22959/? W/DnsTlsSocket: SSL_connect error 5, errno=111
2019-10-16 22:07:49.923 1986-2278/system_process W/system_server: JNI critical lock held for 20.017ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:49.963 1986-2278/system_process W/system_server: JNI critical lock held for 19.981ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:49.983 1986-2278/system_process W/system_server: JNI critical lock held for 20.005ms on Thread[94,tid=2278,Runnable,Thread*=0xbf687800,peer=0x13f51810,"Binder:1986_6"]
2019-10-16 22:07:50.504 2828-2839/com.google.process.gservices W/ocess.gservice: Reducing the number of considered missed Gc histogram windows from 185 to 100
2019-10-16 22:07:52.301 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:52.362 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:52.431 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:52.445 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:52.519 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:52.540 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:53.357 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:53.402 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:57.495 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:57.531 23189-23189/? W/kworker/0:1: type=1400 audit(0.0:12555): avc: denied { module_request } for kmod="net-pf-16-proto-4-type-2-17" scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=system permissive=0
2019-10-16 22:07:57.581 23189-23189/? W/kworker/0:1: type=1400 audit(0.0:12556): avc: denied { module_request } for kmod="net-pf-16-proto-4-type-2-17" scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=system permissive=0
2019-10-16 22:07:57.626 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:57.758 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:57.794 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:57.886 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:57.895 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:58.289 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:58.320 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:07:58.765 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:07:58.831 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:08:02.384 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:08:02.517 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:08:02.619 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:08:02.637 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
2019-10-16 22:08:03.518 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 1 6
2019-10-16 22:08:03.554 22186-22208/com.app.pmall D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 2
android webview popupwindow
1个回答
0
投票

在上面的代码中,为每个弹出窗口创建“ newWebView”的新实例。您不能每次都重复使用相同的newWebView。

 webView.setWebChromeClient(new WebChromeClient() {

        //private WebView newWebView = new WebView(c);

        @Override
        public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {

            WebView newWebView = new WebView(c);
            newWebView.setWebViewClient(new WebActivityClient(c) {
                                            @Override
                                            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                                                Intent intent = new Intent(c,PopupActivity.class);
                                                intent.putExtra("URL", url);
                                                startActivity(intent);
                                            }
                                        });
            WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
            transport.setWebView(newWebView);
            resultMsg.sendToTarget();
                    return true;
                }
            });
}
private class WebActivityClient extends WebViewClient{
    public WebActivityClient(Context c) {
    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView view,String url){
        view.loadUrl(url);
        return true;
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.