2
我試圖打印網頁視圖的HTML在機器人API 19. PrintDocumentAdapter根據文檔在API級別19添加被訪問LayoutResultCallback()在LayoutResultCallback中不公開;不能從外部包錯誤而生成PDF
https://developer.android.com/reference/android/print/PrintDocumentAdapter.html
和
https://developer.android.com/reference/android/print/PrintDocumentAdapter.LayoutResultCallback.html
但我正在逐漸2錯誤
Error:(38, 64) error: LayoutResultCallback() is not public in LayoutResultCallback; cannot be accessed from outside package
和
Error:(42, 101) error: WriteResultCallback() is not public in WriteResultCallback; cannot be accessed from outside package
我的代碼是
public void print(final PrintDocumentAdapter printAdapter, final File path, final String fileName) {
printAdapter.onLayout(null, printAttributes, null, new PrintDocumentAdapter.LayoutResultCallback() {
@Override
public void onLayoutFinished(PrintDocumentInfo info, boolean changed) {
printAdapter.onWrite(null, getOutputFile(path, fileName), new CancellationSignal(), new PrintDocumentAdapter.WriteResultCallback()
{
@Override
public void onWriteFinished(PageRange[] pages) {
super.onWriteFinished(pages);
openHome();
}
}
);
}
}, null);
}
請需要儘快幫助。