# FrameCallbackScheduler

# FrameCallbackScheduler

Artifact:[androidx.dynamicanimation:dynamicanimation](https://developer.android.com/jetpack/androidx/releases/dynamicanimation)  
[View Source](https://cs.android.com/search?q=file:androidx/dynamicanimation/animation/FrameCallbackScheduler.java+class:androidx.dynamicanimation.animation.FrameCallbackScheduler)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/dynamicanimation/animation/FrameCallbackScheduler "View this page in Java")

<br />

```
interface FrameCallbackScheduler
```

<br />

*** ** * ** ***

A scheduler that runs the given Runnable on the next frame.

## Summary

|                                ### Public functions                                 |
|-------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isCurrentThread](https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler#isCurrentThread())`()` Returns whether the current thread is the same as the thread that the scheduler is running on.                                                    |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [postFrameCallback](https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler#postFrameCallback(java.lang.Runnable))`(frameCallback: `[Runnable](https://developer.android.com/reference/java/lang/Runnable.html)`)` Callbacks on new frame arrived. |

## Public functions

### isCurrentThread

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.1.0)  

```
fun isCurrentThread(): Boolean
```

Returns whether the current thread is the same as the thread that the scheduler is running on.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the scheduler is running on the same thread as the current thread. |

### postFrameCallback

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.1.0)  

```
fun postFrameCallback(frameCallback: Runnable): Unit
```

Callbacks on new frame arrived.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|--------------------------------------------|
| `frameCallback: `[Runnable](https://developer.android.com/reference/java/lang/Runnable.html) | The runnable of new frame should be posted |