2015-10-28 3 views
-3

Я пытаюсь загрузить веб-страницу внутри webview.the загрузки веб-страницы внутри Dialog.i'm, попробовал этот код. Но покажите ошибку builder (android.content.context) in builder cannot be applied to .. и подчеркивание this в красной линии.builder (android.content.context) в builder не может быть применен к Activity

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(); 
} 
+0

попробуйте использовать контекст ПОЛУЧИТЬ –

ответ

0

Попробуйте this->

WebView webView = new WebView(this); 
webView.loadUrl("http://www.google.com/"); 
AlertDialog.Builder dialog = new AlertDialog.Builder(this); 
dialog.setView(webView); 
dialog.setPositiveButton("Okay", null); 
dialog.show(); 

Check This Too ->android: webview inside dialog or popup

Смежные вопросы