Articles

Affichage des articles associés au libellé Builder

Android alerts tutorial

Image
In this tutorial we will talk about Android dialog boxes and more specifically AlertDialog. Like any modal dialog box, an AlertDialog opens itself, takes focus and stay on as long as the user does not close it. This type of display is therefore well suited to critical errors or any other information which must read by the user. To create an AlertDialog, the easiest way is to use the Builder class, which provides a set of methods for configuring an AlertDialog. Each method returns the Builder to facilitate the chaining of calls. In the end, just call the show() method of the Builder Object  to display the dialog box. The most used configuration method of Builder are: ● setMessage () defines the "body" of the dialog from a simple text message. Its setting is a String or an identifier of a text resource. ● setTitle () and setIcon () to configure the text and / or icon that will appear  in the title bar of the dialog box. ● setPositiveButton () setNeutralButton () and