Intent
An Intent is a messaging object you can use to request an action from another app component. You can use the Intent component to start a new acitivity or pass data to another activity.
Example
Set of blocks to start another activity while passing the data of someValue
with key someKey
.
Blocks
setData
Used to point to the location of a data object (like a file for example), while putExtra adds simple data types (such as an SMS text string for example).
Type | Explanation | Required |
---|---|---|
Intent | Intent Component | Yes |
String | Data to transfer to next activity. Read more here. | No |
setScreen
Sets the screen to navigate to.
Type | Explanation | Required |
---|---|---|
Intent | Intent Component | Yes |
Activity | Activity to navigate to | Yes |
putExtra
Pass data to another Activity. After you pass the data, you retrieve the data using the Activity getExtra key []
block.
Type | Explanation | Required |
---|---|---|
Intent | Intent Component | Yes |
String | Key value used to retrieve later | Yes |
String | Value to pass | Yes |
setFlags
Change the behavior of an activity.
SINGLE_TOP
— Organizes the views in a way that if the view you’re about to transition to was already called before, it would bring that view to the top rather than putting another copy on the top.CLEAR_TOP
- Clears all the previous views.
Type | Explanation | Required |
---|---|---|
Intent | Intent Component | Yes |
Flag | Flag to set | Yes |
startActivity
Start a new activity.
Type | Explanation | Required |
---|---|---|
Intent | Intent Component | Yes |