86.8 Starting the Print Job
When the “Print Document” button is touched by the user, the printDocument() onClick event handler method will be called. All that now remains before testing can commence, therefore, is to add this method to the MainActivity.kt file, taking particular care to ensure that it is placed outside of the MyPrintDocumentAdapter class:
package com.ebookfrenzy.customprint
.
.
import android.print.PrintManager
import android.view.View
class MainActivity : AppCompatActivity() {
fun printDocument(view: View) {
val printManager = this
.getSystemService(Context.PRINT_SERVICE) as PrintManager
val jobName = this.getString(R.string.app_name) + " Document"
...