Dave's Brain

Browse - Programming Tips - How can I display a quick popup message?

Date: 2016jun16
OS: Android
Level: beginner

Q.  How can I display a quick popup message?

A.  Use toast or snackbar.

Snackbar is the more modern way so lets see it first:

import android.support.design.widget.Snackbar; Snackbar.make(view, "Hello World", Snackbar.LENGTH_LONG) .setAction("Action", null).show();
import android.widget.Toast; Toast.makeText(context, "Hello World", Toast.LENGTH_LONG).show();

Add a comment

Sign in to add a comment
Copyright © 2008-2018, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.