How to Create Custom Toast in Android

Make your Toast more attractive

You can implement custom toast in two ways:

Method 1 : create your own toast layout without external resources

Method 2 : You can use external libraries to make custom toast


Step 1: create drawable file for background

Step 2: create custom layout

Step 3: inflate the layout into view and set into toast object

There are many external libraries to implement custom toast
but in this post we will use Toasty library. In this library there are 5 types of custom toast:
success , error , info , warning and normal


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

allprojects {
repositories {

maven { url “" }

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

dependencies {
implementation 'com.github.GrenderG:Toasty:1.5.0'

Step 3: Go to java file and show the toast as below

Toasty.success(getApplicationContext(),"This is success toast",Toast.LENGTH_LONG).show();// or Toasty.error(getApplicationContext(),"This is error toast",Toast.LENGTH_LONG).show();


Source code:



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
Ahmed Basalib

Software Engineer | Frontend Developer | Reactjs Dev | Nextjs Technical Product Manager