# Intent

## Examples

### Basic Examples

#### Start a Activity

<div align="left"><img src="/files/-M7cMikwADKydRjo6irX" 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="/files/-M7cRbePK741-20mQVnm" 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sketchwaredocs.gitbook.io/home/components/intent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
