I am trying to get a webview into a popup dialog. I can get it to pop up with the webview, but when I try to make it load a Url, it crashes my app… Any help? I have also tried putting the webview settings in OnCreate.
case R.id.calculatorBtn:
Dialog dialog = new Dialog(DrawingActivity.this);
dialog.setContentView(R.layout.webviewdialog);
dialog.setTitle("Calculator");
dialog.setCancelable(true);
dialog.show();
IT WORKS FINE UNTIL I ADD THE STUFF BELOW THIS LINE.
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://myurl.com/hi.html");
break;
Could you please supply more code (maybe the entire method/class) so we can see the context in which this is placed. There is a good chance that the previous code is causing this part to crash.