Thursday, 23 June 2016

Android Toast Example

Android Toast can be used to display information for the short period of time. A toast contains message to be displayed quickly and disappears after sometime. 
Toast class is used to show notification for a particular interval of time. After sometime it disappears. It doesn't block the user interaction. See this Example
package sahil.toast;

import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override    protected void onCreate(Bundle savedInstanceState) {
        Toast.makeText(getApplicationContext(),"Hello friends Good Morning",Toast.LENGTH_SHORT).show();
 You can also create custom toast for example
 toast displaying image.You can see custom toast
 example in next page to see the code for 
custom toast.

No comments:

Post a Comment