public final class Intent
extends java.lang.Object
If the intent is executed, proper registered handler is chosen to perform the actual operation.
For example, the following code can be used to open a file in editor (if the environment is suitable for such operation).
new Intent(Intent.ACTION_VIEW, new URI("file://path/file.txt")).execute();
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
ACTION_EDIT |
Standard EDIT action type.
|
static java.lang.String |
ACTION_VIEW |
Standard VIEW action type.
|
| Constructor | Description |
|---|---|
Intent(java.lang.String action,
java.net.URI uri) |
Constructor for an intended operation.
|
| Modifier and Type | Method | Description |
|---|---|---|
java.util.concurrent.Future<java.lang.Object> |
execute() |
Execute the intent.
|
void |
execute(Callback callback) |
Execute the intent.
|
java.lang.String |
getAction() |
Get action type.
|
java.util.SortedSet<? extends IntentAction> |
getIntentActions() |
Get available actions for the intent.
|
java.net.URI |
getUri() |
Get URI specifying this intent.
|
java.lang.String |
toString() |
public static final java.lang.String ACTION_VIEW
public static final java.lang.String ACTION_EDIT
public Intent(@NonNull
java.lang.String action,
@NonNull
java.net.URI uri)
action - Action type to perform. It is recommended to use either
standard actions predefined in Intent class (see ACTION_EDIT,
ACTION_VIEW), or strings similar to fully qualified field names
(e.g. "org.some.package.ClassName.ACTION_CUSTOM").uri - URI specifying the operation.@NonNull public java.lang.String getAction()
@NonNull public java.net.URI getUri()
@NonNull public java.util.concurrent.Future<java.lang.Object> execute()
If the result is ignored, it's recommended to use
intent.execute(null);
Future Future for result of the action. The type of
result depends on implementation of chosen intent handler, it can be
null.public void execute(@NullAllowed
Callback callback)
callback - Callback object that will be notified when the execution
completes. If callback is null, the result will be ignored.@NonNull public java.util.SortedSet<? extends IntentAction> getIntentActions()
public java.lang.String toString()
toString in class java.lang.ObjectBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.