Displaying A Toast Message With Image

This example shows how to display toast message with image in android.

Algorithm:

1.) Create a new project by File-> New -> Android Project name it ToastWithImageExample.

2.) Write following into main.xml:

 

 

3.) Run for output.

Steps:

1.) Create a project named ToastWithImageExample and set the information as stated in the image.

Build Target: Android 4.4
Application Name: ToastWithImageExample
Package Name: com.example.ToastWithImageExample
Activity Name: ToastWithImageExampleActivity

ToastWithImageExample1

2.) Open ToastWithImageExampleActivity.java file and write following code there:

 

 

3.) Compile and build the project.

Output

ToastWithImageExample2