public class

CommonToast

extends Object
java.lang.Object
   ↳ com.pdftron.pdf.utils.CommonToast

Class Overview

Toast decorator allowing for easy cancellation of notifications. Use this class if you want subsequent Toast notifications to overwrite current ones.

By default, a current CommonToast notification will be cancelled by a subsequent notification. This default behaviour can be changed by calling certain methods like show(boolean).

Summary

Public Methods
void cancel()
Close the view if it's showing, or don't show it if it isn't showing yet.
void show()
Show the view for the specified duration.
void show(boolean cancelCurrent)
Show the view for the specified duration.
static void showText(Context context, CharSequence text, int duration)
Show a standard CommonToast that just contains a text view.
static void showText(Context context, CharSequence text, int duration, int gravity, int xOffset, int yOffset)
static void showText(Context context, int resId)
Show a standard CommonToast that just contains a text view with the text from a resource.
static void showText(Context context, CharSequence text)
Show a standard CommonToast that just contains a text view.
static void showText(Context context, int resId, int duration, int gravity, int xOffset, int yOffset)
static void showText(Context context, int resId, int duration)
Show a standard CommonToast that just contains a text view with the text from a resource.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void cancel ()

Close the view if it's showing, or don't show it if it isn't showing yet. You do not normally have to call this. Normally view will disappear on its own after the appropriate duration.

public void show ()

Show the view for the specified duration. By default, this method cancels any current notification to immediately display the new one. For conventional show() queueing behaviour, use method show(boolean).

See Also

public void show (boolean cancelCurrent)

Show the view for the specified duration. This method can be used to cancel the current notification, or to queue up notifications.

Parameters
cancelCurrent true to cancel any current notification and replace it with this new one
See Also

public static void showText (Context context, CharSequence text, int duration)

Show a standard CommonToast that just contains a text view.

Parameters
context The context to use. Usually your android.app.Application or android.app.Activity object.
text The text to show. Can be formatted text.
duration How long to display the message. Either LENGTH_SHORT or LENGTH_LONG

public static void showText (Context context, CharSequence text, int duration, int gravity, int xOffset, int yOffset)

public static void showText (Context context, int resId)

Show a standard CommonToast that just contains a text view with the text from a resource. Duration defaults to LENGTH_SHORT.

Parameters
context The context to use. Usually your android.app.Application or android.app.Activity object.
resId The resource id of the string resource to use. Can be formatted text.
Throws
if the resource can't be found.
Resources.NotFoundException

public static void showText (Context context, CharSequence text)

Show a standard CommonToast that just contains a text view. Duration defaults to LENGTH_SHORT.

Parameters
context The context to use. Usually your android.app.Application or android.app.Activity object.
text The text to show. Can be formatted text.

public static void showText (Context context, int resId, int duration, int gravity, int xOffset, int yOffset)

Throws
Resources.NotFoundException

public static void showText (Context context, int resId, int duration)

Show a standard CommonToast that just contains a text view with the text from a resource.

Parameters
context The context to use. Usually your android.app.Application or android.app.Activity object.
resId The resource id of the string resource to use. Can be formatted text.
duration How long to display the message. Either LENGTH_SHORT or LENGTH_LONG
Throws
if the resource can't be found.
Resources.NotFoundException