Understanding the RenderThread

A new system-managed processing thread called RenderThread keeps animations smooth even when there are delays in the main UI thread.

  1. The display list can be drawn as many times as needed without further interaction with the business logic.
  2. Certain operations (like translation, scale, etc.) can be done on the entire list without the need to re-issue any drawing operation.
  3. Once all the drawing operations are known, they can be optimised: for example, all text is drawn together in one pass when possible.
  4. The handling of the display list can potentially be offloaded to another thread.
  • A target DisplayListCanvas must be manually set, and can’t be changed afterwards.
  • It’s “fire and forget”: after being started it can only be cancelled (no pause/resume) and there’s no way to know the current value.
  • A custom Interpolator can be provided and the code will be called from the RenderThread.
  • The start delay is generally waited on the RenderThread.

View properties (accessible through View.animate):

Canvas methods (with CanvasProperty):

  • drawCircle(centerX, centerY, radius, paint)
  • drawRoundRect(left, top, right, bottom, cornerRadiusX, cornerRadiusY, paint)

Paint properties:

  • Alpha
  • Stroke width

TL;DR can I make my animations run on the RenderThread?

--

--

--

Android GDE & Lead Android Engineer @Clue

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eugenio Marletti

Eugenio Marletti

Android GDE & Lead Android Engineer @Clue

More from Medium

Using Android Jetpack Compose

Language Change Programmatically in Kotlin, Grow Your Apps Audience Using Localization…

Push notifications on Android, How They Always Get Delivered

Push notifications on Android — How they always get delivered

Button Composable in Jetpack Compose (with updated Material Design 3)