# 3.1 Activities

In the previous chapter, we mentioned how each activity consists of a layout file controlling the design and a class file to help with the logic behind all the different GUI elements. So far in our application we’ve only been working with one `Activity` class, but an application can have several!

Let’s see an example of this in action with Eatery.&#x20;

![MainActivity (1) and CampusMenuActivity (2)](/files/-Lv_AIpRDpcnysFYStJu)

The two different screens displayed here are each their own activities in the codebase. When the user clicks an Eatery card in `MainActivity`, we say we launch the second activity. In the `onCreate()` method of the second activity, we populate the `TextView` and wait times chart with the appropriate values. When the user clicks the back button in the second activity, then we say that the second activity has **finished**, and the display returns to `MainActivity` (which is the last unfinished activity).

## A Deeper Look

Returning to our project with the single `MainActivity` class, we can see that `MainActivity` extends `AppCompatActivity`, which is a built-in class that extends `android.app.activity`.&#x20;

This tells us that `MainActivity` is of type `Activity`, and so all of the `Activity` class methods become available for the programmer, including `setContentView()` and the overridden method `onCreate()`.


---

# 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://android-course.cornellappdev.com/chapters/3.-intent-and-manifest/3.1-activities.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.
