Everybody Loves Vibrating Toasts

I came across an interesting idea on stackoverflow.com for Toast notifications on Android.

It’s a simple class that extends Toast. We will modify the constructor to vibrate your device when this new Toast is displayed on screen. Below is the ~5 lined class:

public class VibratingToast extends Toast {
public VibratingToast(Context context, CharSequence text, int duration) {
super(context);

((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE)).vibrate(300);

super.makeText(context, text, duration).show();
}
}

Continue reading