Android Application Development (AND-401) — Question 91
Which of the following sets the entire Activity window as a WebView?
Answer options
- A. WebView webview = new WebView(this); webview.setAsWindow;
- B. setContentView(R.layout.webview);
- C. WebView webview = new WebView(this); setContentView(webview);
- D. setContentView("http://www.androidatc.com");
Correct answer: C
Explanation
Option C is correct because it creates a new WebView instance and sets it as the content view of the Activity. Option A is incorrect because 'setAsWindow' is not a valid method for WebView. Option B sets a layout resource instead of directly using a WebView, and Option D incorrectly attempts to set a string URL as the content view, which is not valid.