You can generate a toast message easily and fast by Toaster.
Toaster has four styles for different statuses that include information, success, warning, and error.
Add this line to your build.gradle
file:
dependencies {
implementation 'com.github.mhadikz:toaster:1.0.0'
}
Toaster needs some parameters for generating your toast and call show()
. You have to create a builder for showing Toaster message:
new Toaster.Builder(<Context>)
.setTitle(<Title text>)
.setDescription(<Description text>)
.setDuration(<Duration time by selecting from Toaster>)
.setStatus(<Toast status by selecting from Toaster.Status>)
.show();
new Toaster.Builder(this)
.setTitle(getString(R.string.info_title))
.setDescription(getString(R.string.info_description))
.setDuration(Toaster.LENGTH_SHORT)
.setStatus(Toaster.Status.INFO)
.show();