Skip to content

LottieAlertDialog

Leonardo D. Palma edited this page Mar 27, 2025 · 2 revisions

Create and display an Lottie animation dialog. See Lottie

Usage

LottieAlertDialog

In code:

LottieAlertDialog.Builder(applicationContext)
                    .setAnimation(R.raw.animation_welcome) //Required or setAnimationFromUrl(url)
                    .setCancelable(false)
                    .setTimeout(10000) //Required if cancelable = false
                    .create()
                    .show()

Attributes

LottieAlertDialog offers several attributes for a deeper view configuration, the following table shows all these options and their default value.

Name Description Values Default Related method(s)
Builder Creates a builder for an alert dialog that uses the default alert dialog theme Context N/A Builder()
Animation Sets the animation String, Int N/A setAnimation()
Animation Sets the animation url String N/A setAnimationFromUrl()
Repeat Sets the animation repeat count Int N/A setAnimationRepeatCount()
Speed Sets the animation speed Float N/A setAnimationSpeed()
Gravity Set gravity of the dialog Int [android.view.Gravity] N/A setGravity()
Cancelable Sets whether the dialog is cancelable or not Boolean true setCancelable()
LayoutParams Sets the layout params Int N/A setLayoutParams()
Timeout Sets the timeout Long N/A setTimeout()
create Creates an IOSProgressDialog with the arguments supplied to this builder - - create()
show Start the dialog and display it on screen - - show()

If you want to add more functionality to dialog events, you can use the following methods to capture the actions.

  • When the dismiss option is called from the dialog box, you can use the setOnDismissListener method to perform additional actions.
  • When the cancel option is called from the dialog box, you can use the setOnCancelListener method to perform additional actions.
  • When the show option is called from the dialog box, you can use the setOnShowListener method to perform additional actions.
  • When the timeout option the dialog to automatically dismiss after a specified duration, you can use the setTimeout method.

Clone this wiki locally