Display a toast in Android

Easy function to display a toast.


Libraries

Code Snippet
void makeToast(String text) {
    Toast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG).show();
}


Implementation

This should display a toast with text "Hello World!"<code>makeToast("Hello World!");</code>





Comments
  • mode_editWrite a comment



  • forumComments

    Notice: Undefined index: username in /var/www/snip/includes/comments.php on line 40

    Notice: Undefined index: admin in /var/www/snip/includes/comments.php on line 40
    • Profile Image

      toll by Tobi at 2016-12-06 16:01:37

    jetjzt kenner ich meihgnvh eendlich aus




Embed Code

We provide special containers which include the full snippet and a link to this site. So for example when you make a tutorial and you are using code from this site, you can use one of the following snippet embeddings:

Load Preview Get Code Close Preview







    Share
    Rating
    thumb_up 1 thumb_down
    Author
    Thorolus

    I'm the head developer and co-founder of GlovilGames Studios (glovilgames.com) and other platforms GlovilGames created, like vsnippets.com, worth-calculator.net, python-obfuscator.com and some mobile apps and games.

    Tags
    Android
    Toast



    Informations

    posted on 2016-09-15 15:29:30

    viewed 108 times

    snippet's UUID is 57daa23a30e67

    Similar Snippets