Making Simple Toast Notification

Posted by Unknown Senin, 04 April 2011 0 komentar
We use toast notification quite often, especially during testing. Toast notification is a pop up window to show certain message to the users. Toast notification does not involve user interaction (there is no OK, Cancel, Yes, No etc). It will automatically fade in and out. See the sample code below:-

In .java file, put the following code:-

import android.widget.Toast;

public class activityTestToast extends Activity 
{  
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
   {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        //this line will pop up the message when the application is created
        Toast.makeText(this, "Cikucak!!", Toast.LENGTH_SHORT).show();

   }
}

NOTE:-
1. Replace the work "Cikucak" with any message you prefer.
2. Try LENGTH_SHORT or LENGTH_LONG and see the difference

It's quite simple, right?
TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: Making Simple Toast Notification
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke https://androidemoticonss.blogspot.com/2011/04/making-simple-toast-notification.html. Terima kasih sudah singgah membaca artikel ini.

0 komentar:

Posting Komentar

Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of android emoticons.