Override Button of AlertDialog – Android

Android
As per the requirement of applications, sometimes we need to provide a custom feature to the buttons of AlertDialog. For instance, we may need to change the color of Positive, Negative, and/or Neutral buttons. And for the same reason, we may need to override button of AlertDialog to provide custom behavior. In this tutorial, we are going to override the buttons of AlertDialog. So, this tutorial covers following points. - Create AlertDialog - Override the Buttons of AlertDialog - Change text color of AlertDialog buttons (more…)
Read More

Create AlertDialog with Custom Layout using XML Layout

Android
As application grows or while building an application for larger group, sometimes it is necessary to use a custom layout in the AlertDialog. The situation can be visualized by having a login dialog, where user would be asked for their login credentials. While creating custom layout for AlertDialog, we have two options, if the custom UI is simple enough to display one or two components then this could be done programmatically, else we need to create an XML layout and include that into the AlertDialog. This post is third in series of tutorials for creating and displaying AlertDialog. (more…)
Read More

Provide Selection from a list of options – Android

Android
This post is second in series of tutorials to create and display an AlertDialog.¬†Before starting this post, let us recap few things from previous post. To create an AlertDialog, we need AlertDialog.Builder and provide all required properties through the builder instance. Buttons are optional in AlertDialog, we can use all combinations of the buttons or we can choose not to use any button at all. AlertDialog can be created without any title. AlertDialog can be created without any message. (more…)
Read More

Create AlertDialog and Basic Usage – Android

Android
Creating and displaying an AlertDialog depends on the use-case of the application. But, the way of creating and displaying depends on the situation. There are several ways of creating it, so, this post is the first¬†in the series of tutorials to create and display an AlertDialog. In this series of tutorials, we will be learning from the basics of creating AlertDialog to add customization to it. Whether it is displaying custom view(s) on the dialog or handling the UI interaction of the dialog. All the source code will be available on GitHub and the link will be shared after completion of each post. (more…)
Read More

Create AlertDialog with Custom Layout Programmatically

Android
As we discussed in the previous post about creating custom layout using XML layout. This post is about creating the same layout programatically. We will be creating all the views to be used in the AlertDialog programatically. Creating layout using XML or programatically is basically developers choice of development. And, it is better to know how things are done programatically, as well. (more…)
Read More