Shows a short toast display - Android android.widget

Android examples for android.widget:Toast

Description

Shows a short toast display

Demo Code

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

public class Main {

  /**/*from w  w  w  . j  av  a 2s.c  om*/
   * Shows a short toast display
   * 
   * @param ctx
   *          application context
   * @param message
   *          message to display
   */
  public static void showToast(Context ctx, String message) {
    Toast toast = Toast.makeText(ctx, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();

  }

}

Related Tutorials