public final class Intent extends 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 and Description |
---|---|
static String |
ACTION_EDIT
Standard EDIT action type.
|
static String |
ACTION_VIEW
Standard VIEW action type.
|
Constructor and Description |
---|
Intent(String action,
URI uri)
Constructor for an intended operation.
|
Modifier and Type | Method and Description |
---|---|
Future<Object> |
execute()
Execute the intent.
|
void |
execute(Callback callback)
Execute the intent.
|
String |
getAction()
Get action type.
|
SortedSet<? extends IntentAction> |
getIntentActions()
Get available actions for the intent.
|
URI |
getUri()
Get URI specifying this intent.
|
String |
toString() |
public static final String ACTION_VIEW
public static final String ACTION_EDIT
public Intent(@NonNull String action, @NonNull URI uri)
action
- Action type to perform. It is recommended to use either
standard actions predefined in Intent class (see Intent.ACTION_EDIT
,
Intent.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 Future<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 SortedSet<? extends IntentAction> getIntentActions()