# Using RadioButtons

## This tutorial uses RadioButtons extension that can be downloaded [HERE](http://community.appybuilder.com/t/about-the-extensions-category/2)

This extension allows you to create **RadioButtons** either vertically (default) or horizontally within a **HorizontalArrangement** Layout. In this tutorial, we'll create a simple President-Quiz that will look like below. When each **Button** is clicked, we will check the response and show message using **Notifier** component.

**Get .apk** [**HERE** ](http://AppyBuilder.com/tutorials/radiobutton/TutRadioButtons.apk)**and .aia**&#x20;

Create a new project. Once project opens, in the **Design Editor**, select the Extensions category and import **RadioButtons** extension. Our sample quiz-app, has 3 questions, each having their own radiobutton possible answers. For each **RadioButtons** component, you can change the **TextColor** and **TextSize**. Customize is as you needed. Also, as shown in image BELOW, we use 3 HorizontalArrangement component. Each of these layouts will be used to hold one-set of responses as shown ABOVE. We use **Labels** to display quiz text and a **Button** to check answer and show status using a **Notifier** component.

![](/files/-L9BuWhv0RRX8Vo1Otl_)

We now use Blocks Editor to code the app behavior. We use&#x20;

**Screen1 Initialize Event**&#x20;

block, to create or radio buttons using&#x20;

**CreateRadioButtons**&#x20;

block. Specify a unique numeric&#x20;

**id**&#x20;

for for each set of radiobuttons, a container, the way that you like to present the radio-buttons&#x20;

(

vertical vs. horizontal

)

&#x20;and&#x20;

**List**&#x20;

of values for each radio-button.

![](/files/-L9BuWiCyDqJGqzgGl0g)

We now need to check answer for the "Check Answer" button is pressed for each group. To simplify the logic, eliminate redundancy, we use a **procedure** that accepts 2 **parameters.** First parameter for checking what user has selected and 2nd parameter for receiving the correct response. To determine which radio-button user has selected, we use **RadioButtons.GetChecked** block. This block returns the text of selected radio-button. If nothing selected, a **-1** will be returned. For **Button1**, to check answer, in its **Click** event, we invoke our procedure, passing it **RadioButtons1.GetChecked** (gets text of selected radio-button for RadioButtons1 group) and for 2nd parameter, we pass it the correct answer. Our procedure now checks to see if parameter responseText is equal to CorrectAnswer and display an Alert accordingly

![](/files/-L9BuWj137_y630AFbDr)


---

# 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://help.appybuilder.com/tutorials/using-radiobuttons.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.
