Example usage for android.print PrintDocumentAdapter onLayout

List of usage examples for android.print PrintDocumentAdapter onLayout

Introduction

In this page you can find the example usage for android.print PrintDocumentAdapter onLayout.

Prototype

public abstract void onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes,
        CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle extras);

Source Link

Document

Called when the print attributes (page size, density, etc) changed giving you a chance to layout the content such that it matches the new constraints.

Usage

From source file:android.webkit.cts.WebViewTest.java

private void printDocumentLayout(final PrintDocumentAdapter adapter, final PrintAttributes oldAttributes,
        final PrintAttributes newAttributes, final LayoutResultCallback layoutResultCallback) {
    mOnUiThread.runOnUiThread(new Runnable() {
        @Override/*from   w  w  w.j  a v  a2  s .  c  om*/
        public void run() {
            adapter.onLayout(oldAttributes, newAttributes, new CancellationSignal(), layoutResultCallback,
                    null);
        }
    });
}