You are on page 1of 2

1.

**Explain any four UI Components of Android application:**


- **TextView:** Displays text on the screen.
- **ImageView:** Displays images or icons.
- **EditText:** Allows user input for text.
- **Button:** Triggers actions when pressed.

2. **List different User Interface Elements:**


- TextView, EditText, Button, ImageView, CheckBox, RadioButton, ToggleButton, Spinner,
ProgressBar, etc.

3. **Explain Toggle Button:**


- A ToggleButton is a two-state button that can be switched between checked and
unchecked states.
- It is typically used for settings or options where the user can turn something on or off.

4. **List different types of views? Explain Scroll view:**


- Types of views include TextView, EditText, Button, ImageView, CheckBox, RadioButton,
etc.
- **ScrollView:** Allows users to scroll through content that is larger than the screen size.

5. **List all attributes to develop a simple button:**


- Attributes for a Button include: `android:id`, `android:text`, `android:layout_width`,
`android:layout_height`, `android:onClick`, etc.

6. **Explain Date and Time picker with its methods:**


- **DatePicker:** Allows users to select a date.
- Methods include `getDayOfMonth()`, `getMonth()`, `getYear()` to retrieve the selected
date.
- **TimePicker:** Allows users to pick a time.
- Methods include `getCurrentHour()`, `getCurrentMinute()` to get the selected time.

7. **What is ImageButton? Explain with an example:**


- ImageButton is a button that displays an image.
- Example:
```xml
<ImageButton
android:id="@+id/imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/your_image" />
```

8. **Explain RadioGroup and RadioButton with an example:**


- **RadioGroup:** Groups RadioButtons together, ensuring only one can be selected at a
time.
- **RadioButton:** Represents an option within a RadioGroup.
- Example:
```xml
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Option 1" />

<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Option 2" />
</RadioGroup>
```

9. **Develop an Android Application Using Time Picker:**


- Unfortunately, providing code in this format isn't practical. However, you can find
examples and tutorials online for creating an Android app with a TimePicker.

10. **Develop an Android Application Using Date Picker:**


- Similar to the Time Picker, examples and tutorials for creating an Android app with a
DatePicker can be found online.

11. **Explain Toast alert with an example:**


- Toast is a simple notification used to display a quick message.
- Example:
```java
Toast.makeText(getApplicationContext(), "Hello, Toast!",
Toast.LENGTH_SHORT).show();
```

12. **Describe Checkbox with an Example:**


- CheckBox allows users to select multiple options.
- Example:
```xml
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Check me" />
```

You might also like