# Intent

## Examples

### Basic Examples

#### Start a Activity

<div align="left"><img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M7cJQ9rbBZcl1lL0_r4%2F-M7cMikwADKydRjo6irX%2FIMG_20200518_171828.jpg?alt=media&#x26;token=df068ab8-b7e6-4d29-b584-c1d3d9b60987" alt="A basic activity starting."></div>

{% hint style="info" %}
This is not closing the activity that was started previously.
{% endhint %}

#### Start a Activity and close the previous one

<div align="left"><img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M7cPcpm8tbzFS8seydP%2F-M7cRbePK741-20mQVnm%2FIMG_20200518_173912.jpg?alt=media&#x26;token=14e01ae7-0394-4412-908d-6be89d266afe" alt="Starts a Activity then closes the previous one"></div>

{% hint style="info" %}
This will close the Activity that was started previously.
{% endhint %}

## 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).

<div align="left"><img src="https://docs.sketchware.io/docs/assets/intent/set-data.png" alt="setData"></div>

### setScreen

Sets the screen to navigate to.

<div align="left"><img src="https://docs.sketchware.io/docs/assets/intent/set-screen.png" alt="setScreen"></div>

### **putExtra**

&#x20;Pass data to another Activity. After you pass the data, you retrieve the data using the `Activity getExtra key []` block.

<div align="left"><img src="https://docs.sketchware.io/docs/assets/intent/put-extra.png" alt="putExtra"></div>

### setFlags

Change the behavior of an activity.

1. `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.
2. `CLEAR_TOP` - Clears all the previous views.

<div align="left"><img src="https://docs.sketchware.io/docs/assets/intent/set-flags.png" alt="setFlags"></div>

### startActivity

Start a new activity.&#x20;

<div align="left"><img src="https://docs.sketchware.io/docs/assets/intent/start-activity.png" alt="startActivity"></div>
