Show long,short Toast : Toast « UI « Android






Show long,short Toast

  
//package com.retain;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.util.Date;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.widget.ImageView;
import android.widget.Toast;

/**
 * @author Nazmul Idris
 * @version 1.0
 * @since Jul 8, 2008, 2:35:39 PM
 */
class AppUtils {

  /**
   * 127.0.0.1 in the emulator points back to itself. Use this if you want to
   * access your host OS
   */
  public static String EmulatorLocalhost = "10.0.2.2";

  /**
   * shows a short message on top of your app... it goes away automatically
   * after a short delay
   */
  public static void showToastShort(Context a, String msg) {
    Toast.makeText(a, msg, Toast.LENGTH_SHORT).show();
  }

  /**
   * shows a short message on top of your app... it goes away automatically
   * after a long delay
   */
  public static void showToastLong(Context a, String msg) {
    Toast.makeText(a, msg, Toast.LENGTH_LONG).show();
  }

  public static void showToast(Context a, String msg, int length) {
    Toast.makeText(a, msg, length).show();
  }


}// end class AppUtils

   
    
  








Related examples in the same category

1.Raise a Toast
2.Toast Message Demo
3.Using Toast.LENGTH_SHORT
4.Toast and Notification, vibrate and sound
5.Show Toast
6.Make Toast Text
7.Responsible for sending Toasts under all circumstances.
8.Toast.LENGTH_SHORT
9.AlertDialog vs Toast
10.The Toast util class
11.show Toast in a Thread
12.Popup Debug Message