Junior — Middle
Can you list the main types of dialog interactions?
sobes.tech AI
Answer from AI
Main types of dialog interactions in Android:
- AlertDialog — a simple dialog with a message and buttons for confirming or canceling an action.
- DatePickerDialog — a dialog for selecting a date.
- TimePickerDialog — a dialog for selecting a time.
- ProgressDialog (deprecated) or progress indicators — show the progress of a task.
- Custom Dialog — a dialog with a custom layout for more complex interactions.
Example of creating an AlertDialog:
AlertDialog.Builder(context)
.setTitle("Attention")
.setMessage("Are you sure?")
.setPositiveButton("Yes") { dialog, _ -> dialog.dismiss() }
.setNegativeButton("No") { dialog, _ -> dialog.dismiss() }
.show()