List of usage examples for android.print PrintManager getPrintJobs
public @NonNull List<PrintJob> getPrintJobs()
From source file:net.olejon.mdapp.MyTools.java
public void printDocument(WebView webView, String title) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { PrintManager printManager = (PrintManager) mContext.getSystemService(Context.PRINT_SERVICE); //noinspection deprecation PrintDocumentAdapter printDocumentAdapter = webView.createPrintDocumentAdapter(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) printDocumentAdapter = webView.createPrintDocumentAdapter(title); String documentName = mContext.getString(R.string.project_name) + " - " + title; PrintJob printJob = printManager.print(documentName, printDocumentAdapter, new PrintAttributes.Builder().build()); List<PrintJob> printJobs = printManager.getPrintJobs(); printJobs.add(printJob);//from www .j a v a2 s .c o m } else { showToast(mContext.getString(R.string.mytools_printing_not_supported), 1); } }