| default | info | success | warning |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| error | custom (only text) | custom (only icon) | custom (full) |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Step 1
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}Step 2
Add the dependency
dependencies {
...
implementation 'com.github.TheHasnatBD:SweetToast:1.0.2'
}To display default short Toast-
SweetToast.defaultShort(context, "YOUR STRING");To display default long Toast-
SweetToast.defaultLong(context, "YOUR STRING");(without duration parameter, every Default Toast's duration is Toast.LENGTH_SHORT)
To display a success Toast-
SweetToast.success(context, "YOUR STRING");
SweetToast.success(context, "YOUR STRING", duration);To display an info Toast-
SweetToast.info(context, "YOUR STRING");
SweetToast.info(context, "YOUR STRING", duration);To display a warning Toast-
SweetToast.warning(context, "YOUR STRING");
SweetToast.warning(context, "YOUR STRING", duration);To display an error Toast-
SweetToast.error(context, "YOUR STRING");
SweetToast.error(context, "YOUR STRING", duration);( duration parameter is must be needed in custom method)
(textColor takes a int value.
textColor example- Color.WHITE or, getResources().getColor(R.color.colorWhite) or Color.parseColor("#FFFFFF"))
To display a partial-custom Toast-
// Only custom Icon >> in pre-defined backgroundColor and textColor : LightGRAY and BLACK
SweetToast.custom(context, "YOUR STRING", drawableIcon, duration);To display a custom Text Toast without Icon-
SweetToast.custom(context, "YOUR STRING", textColor, backgroundDrawable, duration);To display a FULLY custom Toast-
SweetToast.custom(context, "YOUR STRING", drawableIcon, textColor, backgroundDrawable, duration);(If you find/face any problem, please open an issue or make a pull request)









