Stay organized with collections
Save and categorize content based on your preferences.
Window.OnFrameMetricsAvailableListener
public
static
interface
Window.OnFrameMetricsAvailableListener
android.view.Window.OnFrameMetricsAvailableListener
|
Callback for clients that want frame timing information for each
frame rendered by the Window.
Summary
Public methods
onFrameMetricsAvailable
public abstract void onFrameMetricsAvailable (Window window,
FrameMetrics frameMetrics,
int dropCountSinceLastInvocation)
Called when information is available for the previously rendered frame.
Reports can be dropped if this callback takes too
long to execute, as the report producer cannot wait for the consumer to
complete.
It is highly recommended that clients copy the passed in FrameMetrics
via FrameMetrics.FrameMetrics(FrameMetrics)
within this method and defer
additional computation or storage to another thread to avoid unnecessarily
dropping reports.
Parameters |
window |
Window : The Window on which the frame was displayed. |
frameMetrics |
FrameMetrics : the available metrics. This object is reused on every call
and thus this reference is not valid outside the scope of this method. |
dropCountSinceLastInvocation |
int : the number of reports dropped since the last time
this callback was invoked. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Window.OnFrameMetricsAvailableListener\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nWindow.OnFrameMetricsAvailableListener\n======================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/Window.OnFrameMetricsAvailableListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nWindow.OnFrameMetricsAvailableListener\n`\n\n\n`\n\n\n`\n\n|-----------------------------------------------------|\n| android.view.Window.OnFrameMetricsAvailableListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nCallback for clients that want frame timing information for each\nframe rendered by the Window.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onFrameMetricsAvailable](/reference/android/view/Window.OnFrameMetricsAvailableListener#onFrameMetricsAvailable(android.view.Window,%20android.view.FrameMetrics,%20int))`(`[Window](/reference/android/view/Window)` window, `[FrameMetrics](/reference/android/view/FrameMetrics)` frameMetrics, int dropCountSinceLastInvocation) ` Called when information is available for the previously rendered frame. |\n\nPublic methods\n--------------\n\n### onFrameMetricsAvailable\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onFrameMetricsAvailable (Window window, \n FrameMetrics frameMetrics, \n int dropCountSinceLastInvocation)\n```\n\nCalled when information is available for the previously rendered frame.\n\nReports can be dropped if this callback takes too\nlong to execute, as the report producer cannot wait for the consumer to\ncomplete.\n\nIt is highly recommended that clients copy the passed in FrameMetrics\nvia [FrameMetrics.FrameMetrics(FrameMetrics)](/reference/android/view/FrameMetrics#FrameMetrics(android.view.FrameMetrics)) within this method and defer\nadditional computation or storage to another thread to avoid unnecessarily\ndropping reports.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `window` | `Window`: The [Window](/reference/android/view/Window) on which the frame was displayed. \u003cbr /\u003e |\n| `frameMetrics` | `FrameMetrics`: the available metrics. This object is reused on every call and thus **this reference is not valid outside the scope of this method** . \u003cbr /\u003e |\n| `dropCountSinceLastInvocation` | `int`: the number of reports dropped since the last time this callback was invoked. \u003cbr /\u003e |"]]