How to create custom Toast in Android

Updated 15 September 2017

Save

Toast play a major role to enhance user experience on android application. It’s a good practice to show user toast while the user interacts with your application. In this blog, i’m going to show you how we can create custom Toast in Android.First, create a layout (custom_toast) for a Toast here given below code we defined our linear layout with the orientation horizontal and a text view.

Like I said we are creating custom toast so we can add shape drawable, any selector drawable or even place button inside layout which would be displayed as the toast to the user and perform any event on it.

Here my class MakeToast where we define shortToast() method in which we are initializing .

 

To display the user your custom toast:

If you have any doubt comment below.

author
. . .

Leave a Comment

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


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home