我看不到我用下面的新代码打开这个 web 视图。我让它与注释掉的代码一起工作。我需要获取新代码来加载 Web 视图。我使用这个示例代码。如何解决无法打开页面的问题? 示例代码
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
if(requestCode==FILECHOOSER_RESULTCODE)
{
if (null == mUploadMessage) return;
Uri result = intent == null || resultCode != RESULT_OK ? null
: intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.register:
//mWebView2 = (WebView) findViewById(R.id.webview);
// mWebView2.getSettings().setJavaScriptEnabled(true);
// mWebView2.loadUrl("http://www.Mysite.com/AndroidAddMember.aspx");
//mWebView2.setWebViewClient(new HelloWebViewClient());
wv = new WebView(this);
wv.setWebViewClient(new WebViewClient());
wv.getSettings().setJavaScriptEnabled(true);
wv.loadUrl("http://www.Mysite.com/AndroidAddMember.aspx");
wv.setWebViewClient(new WebViewClient());
wv.setWebChromeClient(new WebChromeClient()
{
//The undocumented magic method override
//Eclipse will swear at you if you try to put @Override here
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
BangMeorNot.this.startActivityForResult(Intent.createChooser(i,"File Chooser"), FILECHOOSER_RESULTCODE);
}
});
setContentView(wv);
return true;