Android — Display Custom Toast Messages

Hey. In this article we are gonna see who can we create and display custom Toast messages in Android application.
Andorid Toast can be used to display information for the short period of time. A toast contains message to be displayed quickly and disappears after sometime.

For this tutorial we are gonna use TanTinToast library you can find here.


Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
repositories {
maven { url "" }


Add this to your module’s build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
implementation 'com.github.Evangelidis91:TanTinToast:1.1.3'



Using this library you can display very easy some already implemented Toast messages or create your own.

You can display:

  • Error Toast
  • Success Toast
  • Info Toast
  • Warning Toast
  • Normal Toast
  • Custom Toast

Using Kotlin

To display an error Toast:
TanTinToast.Error(this).text("Error Toast").show()

To display Success Toast:
TanTinToast.Success(this).text("Success Toast").show()

To display Info Toast:
TanTinToast.Info(this).text("Info Toast").show()

To display Warning Toast:
TanTinToast.Warning(this).text("Warning Toast").show()

To display Normal Toast:
TanTinToast.Normal(this).text("Normal Toast").show()

To display Custom Toast:

.text("Custom Toast")

Using Java

To display an error Toast:
new TanTinToast.Error(this).text("Error Toast ").show();

To display Success Toast:
new TanTinToast.Success(this).text("Success Toast").show();

To display Info Toast:
new TanTinToast.Info(this).text("Info Toast").show();

To display Warning Toast:
new TanTinToast.Warning(this).text("Warning Toast").show();

To display Normal Toast:
new TanTinToast.Normal(this).text("Normal Toast").show();

To display Custom Toast:
new TanTinToast.Custom(this).text("Custom Toast").show();

Customize Toast text

.text("Any text")

Customize Toast time


Use TanTinToast.LONG to display toast for 3.5 seconds or TanTinToast.SHORT to display for 2 seconds.

Customize Toast message FontFamily


You can just pass any file under font folder

Customize Toast message TextSIze


Use this method to change Toast message text size. Inserted value declares sp value

Using TanTin.Custom

Using Custom you can customize

  • The icon.
  • The backgroundColor.
  • The textColor.
  • All the previous customizations.

Use .icon(int) to set Toast icon.
Use .background(int) to set Toast backgroundColor.
Use .textColor(int) to set Toast message textColor.

I hope you found this tutorial and this library really helpfull.

Source code here

Feel free to leave any comment.

Thank you very much



Android Developer

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