{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

PressBackAction

public final class PressBackAction extends KeyEventActionBase

java.lang.Object
   ↳ androidx.test.espresso.action.KeyEventActionBase
     ↳ androidx.test.espresso.action.PressBackAction

Performs an Android press back action

Summary

Public constructors

PressBackAction(boolean conditional)

Performs a press back action

PressBackAction(boolean conditional, EspressoKey espressoKey)

Public methods

void
perform(UiController uiController, View view)

Performs this action on the given view.

Inherited methods

From class androidx.test.espresso.action.KeyEventActionBase
Matcher<View>

A mechanism for ViewActions to specify what type of views they can operate on.

String

Returns a description of the view action.

Inherited Constants

From class androidx.test.espresso.action.KeyEventActionBase

Public constructors

PressBackAction

public PressBackAction(boolean conditional)

Performs a press back action

Parameters
boolean conditional

Indicated whether or not to throw an exception when Espresso navigates outside the application or process under test. true will throw.

PressBackAction

public PressBackAction(boolean conditional, EspressoKey espressoKey)

Public methods

perform

public void perform(UiController uiController, View view)

Performs this action on the given view.

Parameters
UiController uiController

the controller to use to interact with the UI.

View view

the view to act upon. never null.