【发布时间】:2015-10-28 13:20:42
【问题描述】:
我正在尝试在 webview 中加载网页。在 Dialog 中加载 webview。我尝试过此代码。但在红线中显示错误 builder (android.content.context) in builder cannot be applied to .. 并在 this 下划线。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webview=(WebView)findViewById(R.id.webview);
webview.setWebViewClient(new WebViewClient();
webview.loadUrl("http://example.com/abc.html");
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setView(webview);
dialog.setPositiveButton("Okay", null);
dialog.show();
}
【问题讨论】:
-
尝试使用获取上下文
标签: android