Return to Snippet

Revision: 52810
at November 1, 2011 23:32 by Vetromilla

Initial Code
import android.content.Context;
import android.widget.Toast;
import android.view.Gravity;

public static void alert(Context context, String message) {
  //New Toast Object with short duration 
  Toast msg = Toast.makeText(context, message, Toast.LENGTH_SHORT); 

  //Setting the gravity to center position
  msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2); 

  //Displaying the alert;

Initial URL

Initial Description
Displays a simple alert using Toast

Initial Title
Simple alert for Android

Initial Tags
simple, android

Initial Language