Responsible for sending Toasts under all circumstances. : Toast « UI « Android






Responsible for sending Toasts under all circumstances.

  
//package org.acra.util;


import android.content.Context;
import android.util.Log;
import android.widget.Toast;

/**
 * Responsible for sending Toasts under all circumstances.
 * <p/>
 * @author William Ferguson
 * @since 4.3.0
 */
public final class ToastSender {

    /**
     * Sends a Toast and ensures that any Exception thrown during sending is handled.
     *
     * @param context           Application context.
     * @param toastResourceId   Id of the resource to send as the Toast message.
     * @param toastLength       Length of the Toast.
     */
    public static void sendToast(Context context, int toastResourceId, int toastLength) {
        try {
            Toast.makeText(context, toastResourceId, toastLength).show();
        } catch (RuntimeException e) {
          //  Log.e(ACRA.LOG_TAG, "Could not send crash Toast", e);
        }
    }
}

   
    
  








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.Toast.LENGTH_SHORT
8.AlertDialog vs Toast
9.Show long,short Toast
10.The Toast util class
11.show Toast in a Thread
12.Popup Debug Message