【发布时间】:2012-02-01 20:49:25
【问题描述】:
我在这里有一些代码(我的活动类和一些扩展 WebViewClient 的类) 所以,在我的活动中,我会这样做:
protected Dialog onCreateDialog(int id) {
switch(id) {
case 1:
//logging vk dialog
Log.d("OLOLOLO", "webview");
dialog = new Dialog(this);
dialog.setContentView(R.layout.webviewl);
dialog.setTitle("loggin in");
webview = (WebView) dialog.findViewById(R.id.vkWebView);
webview.setWebViewClient(wvClforVK);
webview.loadUrl(url);
// do the work to define the pause Dialog
break;
case 2:
// already logged vk dialog
break;
default:
dialog = null;
}
return dialog;
}
然后在某个buttonclick 监听器上调用showDialog(1)。
在 onPageFinished() 方法中的 webview 类中,我需要关闭我的对话框,但我认为这样做是不正确的:
MyActivity activity = new MyActivity(); //my main activity object
activity.dismissDialog(1);
它不起作用:
01-03 20:41:10.758: E/AndroidRuntime(1172): java.lang.IllegalArgumentException: 没有通过 Activity#showDialog 显示 ID 为 1 的对话框
如何让我的活动对象正确关闭对话框?
【问题讨论】:
-
我很高兴看到我不是唯一一个在日志中使用诸如“OLOLOLO”之类的垃圾邮件的人
标签: android dialog webview dismiss