Android Custom Toast Example

By | July 11, 2016

Here you will learn how to create custom toast in android with some text and image.

Toast is used to show some information for specific time period. In android we use android.widget.Toast class to make toast message.

A normal toast message with some text can be created by following code.

Android provide facility to customize toast message. Like if we want a toast message with some text and image. It can be done in following way.


Android Custom Toast Example

1. Create an android project with package name thecrazyprogrammer.androidexample

2. Add an image in res/drawable folder. In this example I have used logo.png.

The project has following structure.

Android Custom Toast Example 1

Add following code in respective files.




It is layout file that contains the code for custom toast.

Here we are simply inflating the custom toast xml into Toast view. When you click on button a custom toast with text and image will pop up for some time. You can also do further customization like changing the text size, color, background, etc.


Android Custom Toast Example 2

If you are facing any difficulty then you can ask it in comment section.

2 thoughts on “Android Custom Toast Example

Leave a Reply

Your email address will not be published. Required fields are marked *