# Create a new Section

{% hint style="info" %}
Before creating a new section please take note of the names of the elements the section is made of and the id of the block you need to add a new section.
{% endhint %}

To create a new section you will need to use the static method

```kotlin
MBurgerAdminTasks.addSection(applicationContext, block_id, params, params_file, Locale.getDefault().getLanguage());
```

Where **`params`** is an ArrayList of **`MBAdminParameter`** and `params_file` is an ArrayList of **`MBAdminParameterFile`**.

&#x20;You will also need to provide the **`Locale`** (in “it” like form) for multilanguage sake support.&#x20;

{% hint style="warning" %}
If the locale you’ll provide is not supported the API will return an error.
{% endhint %}

{% hint style="info" %}
For the address field you should just give the textual address, MBurger API will automatically retrieve latitude and longitude of the address.
{% endhint %}

For example, if your section is composed like:

* `title` -> text field
* `content` -> text field
* `link` -> text field
* `image` -> array of media (images)

So your code for adding a new section (assuming the supported locale is the same as your device) will result like this:

```kotlin
//EditTexts for inserting content
val edt_title: EditText 
val edt_content: EditText
val edt_link: EditText

var listener: MBAdminApiAddSectionListener

var block_id = //BLOCK_ID

//URI of the image, taken from camera or gallery
var img_uri: Uri

fun addSection() {
    val params = ArrayList<MBAdminParameter>()
    params.add(MBAdminParameter(“title”, edt_title.getText().toString()))
    params.add(MBAdminParameter(“content”, edt_content.getText().toString()))
    params.add(MBAdminParameter(“link”, edt_link.getText().toString()))

    val params_file = ArrayList<MBAdminParameterFile>()
    val files = ArrayList<MBAdminSingleFile>()
    files.add(MBAdminSingleFile(getFileName(), 
                                    getMimeType(), 
                                    getUriRealPath(application(), img_uri)));
                                    
    params_file.add(MBAdminParameterFile(“image”, files));

    MBurgerAdminTasks.addSection(applicationContext, 
                                block_id, 
                                listener, 
                                params, 
                                params_file, 
                                Locale.getDefault().getLanguage());
}
```

{% hint style="info" %}
Where **`getFileName()`**, **`getMimeType()`**, **`getUriRealPath(getApplication()`**, **`img_uri`**) are methods to obtain the image name, image mime type and the full file path from the image Uri you should implement on your own.
{% endhint %}


---

# 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://docs.mburger.cloud/android-docs/admin-feature/create-a-new-section.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.
