Pass a value to loadURL - Android

前端 未结 3 729
灰色年华
灰色年华 2020-12-30 08:32

Is it possible to pass a value to the URL mentioned in webView.loadUrl? something like this??

webView.loadUrl(\"file:///android_asset/www/index.html#value=\"         


        
3条回答
  •  攒了一身酷
    2020-12-30 09:16

    I found the solution.. posting it here for the sake of others :)

    I added the following snippet of code in my Activity class which solved the problem,

    webView.setWebViewClient(new WebViewClient() {  
                    @Override  
                    public void onPageFinished(WebView view, String url)  
                    {  
                        webView.loadUrl("javascript:callMe(\""+data_val+"\")");
    
                    }  
                });  
    

    Thanks all :)

提交回复
热议问题