Snackbar.Callback

public class Snackbar.Callback extends BaseTransientBottomBar.BaseCallback


Callback class for Snackbar instances.

Note: this class is here to provide backwards-compatible way for apps written before the existence of the base BaseTransientBottomBar class.

See also
addCallback

Summary

Constants

static final int

Indicates that the Snackbar was dismissed via an action click.

static final int

Indicates that the Snackbar was dismissed from a new Snackbar being shown.

static final int

Indicates that the Snackbar was dismissed via a call to dismiss.

static final int

Indicates that the Snackbar was dismissed via a swipe.

static final int

Indicates that the Snackbar was dismissed via a timeout.

Public constructors

Public methods

void
onDismissed(Snackbar transientBottomBar, int event)

Called when the given BaseTransientBottomBar has been dismissed, either through a time-out, having been manually dismissed, or an action being clicked.

void

Called when the given Snackbar is visible.

Inherited Constants

From com.google.android.material.snackbar.BaseTransientBottomBar.BaseCallback
static final int

Indicates that the Snackbar was dismissed via an action click.

static final int

Indicates that the Snackbar was dismissed from a new Snackbar being shown.

static final int

Indicates that the Snackbar was dismissed via a call to dismiss.

static final int

Indicates that the Snackbar was dismissed via a swipe.

static final int

Indicates that the Snackbar was dismissed via a timeout.

Constants

DISMISS_EVENT_ACTION

public static final int DISMISS_EVENT_ACTION = 1

Indicates that the Snackbar was dismissed via an action click.

DISMISS_EVENT_CONSECUTIVE

public static final int DISMISS_EVENT_CONSECUTIVE = 4

Indicates that the Snackbar was dismissed from a new Snackbar being shown.

DISMISS_EVENT_MANUAL

public static final int DISMISS_EVENT_MANUAL = 3

Indicates that the Snackbar was dismissed via a call to dismiss.

DISMISS_EVENT_SWIPE

public static final int DISMISS_EVENT_SWIPE = 0

Indicates that the Snackbar was dismissed via a swipe.

DISMISS_EVENT_TIMEOUT

public static final int DISMISS_EVENT_TIMEOUT = 2

Indicates that the Snackbar was dismissed via a timeout.

Public constructors

Callback

public Callback()

Public methods

onDismissed

public void onDismissed(Snackbar transientBottomBar, int event)

Called when the given BaseTransientBottomBar has been dismissed, either through a time-out, having been manually dismissed, or an action being clicked.

Parameters
Snackbar transientBottomBar

The transient bottom bar which has been dismissed.

int event

The event which caused the dismissal. One of either: DISMISS_EVENT_SWIPE, DISMISS_EVENT_ACTION, DISMISS_EVENT_TIMEOUT, DISMISS_EVENT_MANUAL or DISMISS_EVENT_CONSECUTIVE.

See also
dismiss

onShown

public void onShown(Snackbar sb)

Called when the given Snackbar is visible.

Parameters
Snackbar sb

The snackbar which is now visible.

See also
show