concept control in category android

This is an excerpt from Manning's book Android in Action, Third Edition.
The DDMS provides a lot of visibility into, and control over, the Android emulator, and is a handy tool for evaluating your Android applications. Before we move on to building and testing Android applications, it’s helpful to understand what’s happening behind the scenes and what’s enabling the functionality of the DDMS.
WebKit powers the browser on the Android device, but it’s also available as an embedded control or widget, permitting SDK-based applications to render HTML directly within a compiled application. This embeddable browser control is highly customizable and thereby empowers the Android developer to exercise a tremendous amount of control over the user experience.
As with any aspect of Java programming, we have to create the required import statements. In this case, the android.webkit package
provides functionality for the browser control. An Activity-scoped variable
is defined for accessing the WebView browser control. A constant
is defined as the starting page for the Activity. The layout is inflated in the same way virtually every Android Activity operates
; the interesting point here is that when this layout inflates, it instantiates a browser control that’s subsequently set up with a call to the method setupBrowser()
. findViewById is used to obtain a reference to the browser control
. With this reference, a number of characteristics of the browser may now be defined. Some of those characteristics are managed by the WebSettings object associated with the browser, so it’s important to get a reference to the settings
. With the settings object available, we enable JavaScript
. Next we customize the behavior for this browser instance by installing our own handlers for UI events with the UAChrome class
, a JavaScript extension
, and a WebViewClient to handle navigation events
. Finally, we get things started with the browser by loading a page of content into the control
.
provides functionality for the browser control. An Activity-scoped variable
is defined for accessing the WebView browser control. A constant
is defined as the starting page for the Activity. The layout is inflated in the same way virtually every Android Activity operates
; the interesting point here is that when this layout inflates, it instantiates a browser control that’s subsequently set up with a call to the method setupBrowser()
. findViewById is used to obtain a reference to the browser control
. With this reference, a number of characteristics of the browser may now be defined. Some of those characteristics are managed by the WebSettings object associated with the browser, so it’s important to get a reference to the settings
. With the settings object available, we enable JavaScript
. Next we customize the behavior for this browser instance by installing our own handlers for UI events with the UAChrome class
, a JavaScript extension
, and a WebViewClient to handle navigation events
. Finally, we get things started with the browser by loading a page of content into the control
.