SliceLiveData
public
final
class
SliceLiveData
extends Object
| java.lang.Object | |
| ↳ | androidx.slice.widget.SliceLiveData |
Class with factory methods for creating LiveData that observes slices.
See also:
Summary
Nested classes | |
|---|---|
class |
SliceLiveData.CachedSliceLiveData
Implementation of |
interface |
SliceLiveData.OnErrorListener
Listener for errors when using |
Public methods | |
|---|---|
static
SliceLiveData.CachedSliceLiveData
|
fromCachedSlice(Context context, InputStream input, SliceLiveData.OnErrorListener listener)
Same as |
static
LiveData<Slice>
|
fromIntent(Context context, Intent intent)
Produces a |
static
LiveData<Slice>
|
fromStream(Context context, InputStream input, SliceLiveData.OnErrorListener listener)
Produces a |
static
LiveData<Slice>
|
fromUri(Context context, Uri uri)
Produces a |
Inherited methods | |
|---|---|
Public methods
fromCachedSlice
public static SliceLiveData.CachedSliceLiveData fromCachedSlice (Context context, InputStream input, SliceLiveData.OnErrorListener listener)
Same as fromStream(Context, InputStream, OnErrorListener) except returns
as type SliceLiveData.CachedSliceLiveData.
| Parameters | |
|---|---|
context |
Context |
input |
InputStream |
listener |
SliceLiveData.OnErrorListener |
| Returns | |
|---|---|
SliceLiveData.CachedSliceLiveData |
|
fromIntent
public static LiveData<Slice> fromIntent (Context context, Intent intent)
Produces a LiveData that tracks a Slice for a given Intent. To use
this method your app must have the permission to the slice Uri.
| Parameters | |
|---|---|
context |
Context |
intent |
Intent |
| Returns | |
|---|---|
LiveData<Slice> |
|
fromStream
public static LiveData<Slice> fromStream (Context context, InputStream input, SliceLiveData.OnErrorListener listener)
Produces a LiveData that tracks a Slice for a given InputStream. To use
this method your app must have the permission to the slice Uri.
This will not ask the hosting app for a slice immediately, instead it will display
the slice passed in through the input. When the user interacts with the slice, then
the app will be started to obtain the current slice and trigger the user action.
| Parameters | |
|---|---|
context |
Context |
input |
InputStream |
listener |
SliceLiveData.OnErrorListener |
| Returns | |
|---|---|
LiveData<Slice> |
|
fromUri
public static LiveData<Slice> fromUri (Context context, Uri uri)
Produces a LiveData that tracks a Slice for a given Uri. To use
this method your app must have the permission to the slice Uri.
| Parameters | |
|---|---|
context |
Context |
uri |
Uri |
| Returns | |
|---|---|
LiveData<Slice> |
|
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2019-12-27 UTC.