ScreenManager
public
class
ScreenManager
extends Object
java.lang.Object | |
↳ | com.google.android.libraries.car.app.ScreenManager |
Manages the stack of Screen
s and their respective Lifecycle
s.
This class is not safe for concurrent access.
Summary
Public methods | |
---|---|
Screen
|
getTop()
Returns the |
void
|
pop()
Pops the top |
void
|
popTo(String marker)
Removes screens from the top of the stack until a |
void
|
push(Screen screen)
Pushes the |
void
|
pushForResult(Screen screen, OnScreenResultCallback onScreenResultCallback)
Pushes a |
void
|
remove(Screen screen)
Removes the |
Inherited methods | |
---|---|
Public methods
getTop
public Screen getTop ()
Returns the Screen
that is at the top of the stack.
Returns | |
---|---|
Screen |
Throws | |
---|---|
NullPointerException |
if the method is called before a Screen has been pushed to
the stack via push(Screen) , or pushForResult(Screen, OnScreenResultCallback) , or returning a Screen from
CarAppService.onCreateScreen(Intent) .
|
pop
public void pop ()
Pops the top Screen
from the stack.
If the top Screen
is the only Screen
in the stack, it will not be removed.
popTo
public void popTo (String marker)
Removes screens from the top of the stack until a Screen
which has the given marker
is found, or the root has been reached.
To pop to root use Screen.ROOT
as the marker
.
The root Screen
will not be popped.
Parameters | |
---|---|
marker |
String |
Throws | |
---|---|
NullPointerException |
if marker is null .
|
See also:
push
public void push (Screen screen)
Pushes the screen
to the stack.
If the screen
pushed is already in the stack it will be moved to the top of the
stack.
Parameters | |
---|---|
screen |
Screen |
Throws | |
---|---|
NullPointerException |
if screen is null .
|
pushForResult
public void pushForResult (Screen screen, OnScreenResultCallback onScreenResultCallback)
Pushes a Screen
, for which you would like a result from, onto the stack.
When the given screen
finishes, the onScreenResultCallback
will receive a
callback to OnScreenResultCallback.onScreenResult(Object)
with the result that the pushed
screen
set via Screen.setResult(Object)
.
Parameters | |
---|---|
screen |
Screen |
onScreenResultCallback |
OnScreenResultCallback |
Throws | |
---|---|
NullPointerException |
if either the screen or the onScreenResultCallback
are null .
|
remove
public void remove (Screen screen)
Removes the screen
from the stack.
If the screen
is the only Screen
in the stack, it will not be removed.
Parameters | |
---|---|
screen |
Screen |
Throws | |
---|---|
NullPointerException |
if screen is null .
|