To display a simple toast, we need to makeText for that toast & then call show() to display it.
To use makeText(), we need to send 3 arguments.
1) Context
2) Text to display in toast
3) Duration How much time its need to be show
At last call show() to display toast.
SOURCE CODE is
package com.ToastExample;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
public class ToastExample extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Toast msg = Toast.makeText(ToastExample.this,
"YOUR TEXT HERE", Toast.LENGTH_LONG);
msg.show();
}
}
The OUTPUT will be