2017-09-24 27 views
0

我有一个webview,我试图加载一个网页,如下图所示,有一个下拉菜单和两个输入需要通过填充这些值来加载我们在机器人的WebView将数据添加到android的webview html输入

我曾尝试这个代码,但它不工作

final String sectionName = getIntent().getStringExtra("sectionName"); 
     final String consumerNumber = getIntent().getStringExtra("consumerNumber"); 
     final String billNumber = getIntent().getStringExtra("billNumber"); 
     this.web = (WebView) findViewById(R.id.web); 
     this.web.loadUrl(Constants.Payment_URL); 
     this.web.getSettings().setJavaScriptEnabled(true); 
     this.web.setWebViewClient(new WebViewClient() { 
      public void onPageFinished(WebView view, String url) { 
       Log.e("TAG", "sectionName:" + sectionName); 
      view.loadUrl("javascript:$($(\"#sectionCode option\")[" + sectionName + "]).prop('selected','selected');$('#ConsumerNo').val('" + consumerNumber + "');$('#billNo').val('" + billNumber + "');"); 
       } 

      public void onPageStarted(WebView view, String url, Bitmap favicon) { 
       super.onPageStarted(view, url, favicon); 
       } 
     }); 

我需要得到加载在程序给出的值Web视图enter image description here

回答