Changes

Jump to: navigation, search

An Android 6 HTML and Web Content Printing Example

15 bytes removed, 08:08, 28 January 2016
m
Text replacement - "<google>BUY_ANDROID_STUDIO6</google>" to "<htmlet>androidstudio_a6</htmlet>"
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
}
</pre>
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
The code changes begin by declaring a variable named myWebView in which will be stored a reference to the WebView instance used for the printing operation. Within the onCreate() method, an instance of the WebView class is created to which a WebViewClient instance is then assigned.
}
</pre>
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
== Adding the Print Menu Option ==
}
</pre>
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
With the onOptionsItemSelected() method implemented, the activity will call a method named createWebPrintJob() when the print menu option is selected from the overflow menu. The implementation of this method is identical to that used in the previous HTMLPrint project and may now be added to the WebPrintActivity.java file such that it reads as follows:
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>

Navigation menu