![]() |
VOOZH | about |
PulseCountDown in Android is an alternative to CountDownTimer. A CountDownTimer is an accurate timer that can be used for a website or blog to display the count-down to any special event, such as a birthday or anniversary. It is very easy to implement PulseCountDown instead of CountDownTimer because PulseCountDown provides a default layout with some beautiful animations. By default, the start value of PulseCountDown is 10 and the end value is 0. Suppose there needs a quiz app, and in that add time limit to answer a question there PulseCountDown can be used.
Note: This library is no longer updated and won't work in newer versions of Android Studio.
XML Attribute | Method | Functionality |
| pc_startValue | startValue(int value) | Starting value of the PulseCountDown (by default 10) |
| pc_endValue | endValue(int value) | Value before which the countdown will stop(by default 0) |
| - | start(callback: () -> Unit = {}) | Start the countdown |
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio.
Note: Minimum SDK version must be more than API 22: Android 5.1 (Lollipop) to implement this dependency. So choose the appropriate SDK while creating the new project.
Navigate to the Gradle Scripts > build.gradle(Module:app) and add the below dependency in the dependencies section.
implementation ("com.gusakov:pulse-countdown:1.1.0-rc2")Navigate to the app > res > layout > activity_main.xml and add the below code to that file. In this file add the PulseCountDown view and a start button to the layout. Below is the code for the activity_main.xml file.
activity_main.xml:
Go to the MainActivity file and refer to the following code. In this file add the onClickListener() method to the button to start the PulseCountDownView. Below is the code for the MainActivity file. Comments are added inside the code to understand the code in more detail.
MainActivity.kt: